From 16492fe7b10f9d6ca46ac6ed05c0b955c8728c48 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 1 Sep 2008 13:53:47 +0000 Subject: [PATCH] (svn r14216) [0.6] -Backport from trunk: makefile/installer changes to support the new compile farm. --- Doxyfile | 2 +- Makefile.bundle | 176 +++++++++++++++++++++++ Makefile.in | 148 ++------------------ Makefile.msvc | 28 ++++ Makefile.src.in | 43 ++++-- config.lib | 199 ++++++++++++++++++++++++--- configure | 6 +- media/openttd.desktop.in | 13 ++ os/win32/installer/install.nsi | 73 ++++++++-- os/win32/installer/version_win32.txt | 5 + os/win32/installer/version_win64.txt | 5 + os/win32/installer/version_win9x.txt | 5 + projects/determineversion.vbs | 37 +++-- 13 files changed, 548 insertions(+), 192 deletions(-) create mode 100644 Makefile.bundle create mode 100644 Makefile.msvc create mode 100644 media/openttd.desktop.in create mode 100644 os/win32/installer/version_win32.txt create mode 100644 os/win32/installer/version_win64.txt create mode 100644 os/win32/installer/version_win9x.txt diff --git a/Doxyfile b/Doxyfile index 6eb9d1232b..43e96772d4 100644 --- a/Doxyfile +++ b/Doxyfile @@ -158,7 +158,7 @@ RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- -GENERATE_MAN = YES +GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO diff --git a/Makefile.bundle b/Makefile.bundle new file mode 100644 index 0000000000..66490caf48 --- /dev/null +++ b/Makefile.bundle @@ -0,0 +1,176 @@ +# +# Creation of bundles +# + +# The revision is needed for the bundle name and creating an OSX application bundle. +ifdef REVISION +REV := $(REVISION) +else +# Are we a SVN dir? +ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) +# Find if the local source if modified +REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) +# Find the revision like: rXXXX-branch +REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); for (i in a) if(a[i]=="branches") { BRANCH="-"a[i+1]; break } } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') +endif +endif +# Make sure we have something in REV +ifeq ($(REV),) +REV := norev000 +endif + +ifndef BUNDLE_NAME +BUNDLE_NAME = OTTD-$(OS)-custom-$(REV) +endif + +# An OSX application bundle needs the data files, lang files and openttd executable in a different location. +ifdef OSXAPP +DATA_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/data +LANG_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/lang +TTD_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/MacOS +else +DATA_DIR = $(BUNDLE_DIR)/data +LANG_DIR = $(BUNDLE_DIR)/lang +TTD_DIR = $(BUNDLE_DIR) +endif + +bundle: all + @echo '[BUNDLE] Constructing bundle' + $(Q)rm -rf "${BUNDLE_DIR}" + $(Q)mkdir -p "${BUNDLE_DIR}" + $(Q)mkdir -p "$(BUNDLE_DIR)/docs" + $(Q)mkdir -p "$(BUNDLE_DIR)/scenario" + $(Q)mkdir -p "$(BUNDLE_DIR)/scenario/heightmap" + $(Q)mkdir -p "$(BUNDLE_DIR)/media" + $(Q)mkdir -p "$(TTD_DIR)" + $(Q)mkdir -p "$(DATA_DIR)" + $(Q)mkdir -p "$(LANG_DIR)" +ifdef OSXAPP + $(Q)mkdir -p "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources" + $(Q)echo "APPL????" > "$(BUNDLE_DIR)/$(OSXAPP)/Contents/PkgInfo" + $(Q)cp "$(ROOT_DIR)/os/macosx/openttd.icns" "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/openttd.icns" + $(Q)$(ROOT_DIR)/os/macosx/plistgen.sh "${BUNDLE_DIR}/$(OSXAPP)" "$(REV)" + $(Q)cp "$(ROOT_DIR)/docs/OSX_install_instructions.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/os/macosx/splash.png" "$(DATA_DIR)" +endif + $(Q)cp "$(BIN_DIR)/$(TTD)" "$(TTD_DIR)/" + $(Q)cp "$(BIN_DIR)/data/"*.grf "$(DATA_DIR)/" + $(Q)cp "$(BIN_DIR)/data/opntitle.dat" "$(DATA_DIR)/" + $(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/" + $(Q)cp "$(ROOT_DIR)/readme.txt" "$(BUNDLE_DIR)/" + $(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/" + $(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/" + $(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/docs/32bpp.txt" "$(BUNDLE_DIR)/docs/" + $(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/" +ifdef MAN_DIR + $(Q)mkdir -p "$(BUNDLE_DIR)/man/" + $(Q)cp "$(ROOT_DIR)/docs/openttd.6" "$(BUNDLE_DIR)/man/" + $(Q)gzip "$(BUNDLE_DIR)/man/openttd.6" +endif + $(Q)cp "$(ROOT_DIR)/media/openttd.32.xpm" "$(BUNDLE_DIR)/media/" + $(Q)cp "$(ROOT_DIR)/media/openttd."*.png "$(BUNDLE_DIR)/media/" +ifdef MENU_DIR + $(Q)cp "$(ROOT_DIR)/media/openttd.desktop" "$(BUNDLE_DIR)/media/" +endif +ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/\"*.scn 2> /dev/null`"; then echo 1; fi), 1) + $(Q)cp "$(BIN_DIR)/scenario/"*.scn "$(BUNDLE_DIR)/scenario/" +endif +ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/heightmaps/\"* 2>/dev/null`"; then echo 1; fi), 1) + $(Q)cp "$(BIN_DIR)/scenario/heightmaps/"* "$(BUNDLE_DIR)/scenario/heightmap/" +endif +ifeq ($(TTD), openttd.exe) + $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt" +endif + +### Packing the current bundle into several compressed file formats ### +# +# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg. +# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle. +# +# One can supply a custom name by adding BUNDLE_NAME:= to the make command. +# +bundle_zip: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).zip' + $(Q)mkdir -p "$(BUNDLES_DIR)" + $(Q)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" . + +bundle_gzip: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz' + $(Q)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.gzip" && tar -zc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.gz" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.gzip" + +bundle_bzip2: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2' + $(Q)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.bzip2" && tar -jc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.bz2" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.bzip2" + +bundle_lha: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).lha' + $(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)" + $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/" + $(Q)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)" + $(Q)rm -rf "$(BUNDLES_DIR)/.lha" + +bundle_dmg: bundle + @echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg' + $(Q)mkdir -p "$(BUNDLES_DIR)/OpenTTD $(REV)" + $(Q)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/OpenTTD $(REV)" + $(Q)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/OpenTTD $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg" + $(Q)rm -fr "$(BUNDLES_DIR)/OpenTTD $(REV)" + +bundle_exe: all + @echo '[BUNDLE] Creating $(BUNDLE_NAME).exe' + $(Q)mkdir -p "$(BUNDLES_DIR)" + $(Q)unix2dos "$(ROOT_DIR)/docs/"* "$(ROOT_DIR)/readme.txt" "$(ROOT_DIR)/COPYING" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt" + $(Q)cd $(ROOT_DIR)/os/win32/installer && makensis.exe //DVERSION_INCLUDE=version_$(PLATFORM).txt install.nsi + $(Q)mv $(ROOT_DIR)/os/win32/installer/*$(PLATFORM).exe "$(BUNDLES_DIR)/$(BUNDLE_NAME).exe" + +ifdef OSXAPP +install: + @echo '[INSTALL] Cannot install the OSX Application Bundle' +else +install: bundle + @echo '[INSTALL] Installing OpenTTD' + $(Q)install -d "$(INSTALL_BINARY_DIR)" + $(Q)install -d "$(INSTALL_ICON_DIR)" + $(Q)install -d "$(INSTALL_DATA_DIR)/gm" + $(Q)install -d "$(INSTALL_DATA_DIR)/data" + $(Q)install -d "$(INSTALL_DATA_DIR)/lang" + $(Q)install -d "$(INSTALL_DOC_DIR)" + $(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)" + $(Q)install -m 644 "$(BUNDLE_DIR)/lang/"* "$(INSTALL_DATA_DIR)/lang" + $(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data" + $(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DOC_DIR)" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.xpm" "$(INSTALL_ICON_DIR)" +ifdef ICON_THEME_DIR + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/16x16/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.16.png" "$(INSTALL_ICON_THEME_DIR)/16x16/apps" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/32x32/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.png" "$(INSTALL_ICON_THEME_DIR)/32x32/apps" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/48x48/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.48.png" "$(INSTALL_ICON_THEME_DIR)/48x48/apps" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/64x64/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.64.png" "$(INSTALL_ICON_THEME_DIR)/64x64/apps" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/128x128/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.128.png" "$(INSTALL_ICON_THEME_DIR)/128x128/apps" + $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/256x256/apps" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.256.png" "$(INSTALL_ICON_THEME_DIR)/256x256/apps" +else + $(Q)install -m 644 "$(BUNDLE_DIR)/media/"*.png "$(INSTALL_ICON_DIR)" +endif +ifdef MAN_DIR + $(Q)install -d "$(INSTALL_MAN_DIR)" + $(Q)install -m 644 "$(BUNDLE_DIR)/man/openttd.6.gz" "$(INSTALL_MAN_DIR)" +endif +ifdef MENU_DIR + $(Q)install -d "$(INSTALL_MENU_DIR)" + $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.desktop" "$(INSTALL_MENU_DIR)" +endif + $(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)" +endif # OSXAPP diff --git a/Makefile.in b/Makefile.in index 97cfd8b475..100b9498f8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,14 +14,21 @@ CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!! CONFIGURE_FILES = !!CONFIGURE_FILES!! LIPO = !!LIPO!! BIN_DIR = !!BIN_DIR!! +ICON_THEME_DIR = !!ICON_THEME_DIR!! +MAN_DIR = !!MAN_DIR!! +MENU_DIR = !!MENU_DIR!! SRC_DIR = !!SRC_DIR!! ROOT_DIR = !!ROOT_DIR!! BUNDLE_DIR = "$(ROOT_DIR)/bundle" BUNDLES_DIR = "$(ROOT_DIR)/bundles" INSTALL_DIR = !!INSTALL_DIR!! INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!! +INSTALL_MAN_DIR = "$(INSTALL_DIR)/$(MAN_DIR)" +INSTALL_MENU_DIR = "$(INSTALL_DIR)/$(MENU_DIR)" INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!! +INSTALL_ICON_THEME_DIR = "$(INSTALL_DIR)/$(ICON_THEME_DIR)" INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!! +INSTALL_DOC_DIR = "$(INSTALL_DIR)/"!!DOC_DIR!! TTD = !!TTD!! TTDS = $(SRC_DIRS:%=%/$(TTD)) OS = !!OS!! @@ -30,7 +37,7 @@ REVISION = !!REVISION!! AWK = !!AWK!! DISTCC = !!DISTCC!! -RES := $(shell if ! [ -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST)`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi ) +RES := $(shell if [ ! -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST)`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi ) all: config.cache ifdef DISTCC @@ -107,6 +114,7 @@ mrproper: done $(Q)rm -rf objs $(Q)rm -f Makefile Makefile.am + $(Q)rm -f media/openttd.desktop $(Q)rm -f $(CONFIG_CACHE_SOURCE_LIST) config.cache config.log $(Q)rm -rf $(BUNDLE_DIR) $(Q)rm -rf $(BUNDLES_DIR) @@ -135,140 +143,4 @@ run-prof: all $(MAKE) -C $$dir $@; \ done -# -# Creation of bundles -# - -# The revision is needed for the bundle name and creating an OSX application bundle. -ifdef REVISION -REV := $(REVISION) -else -# Are we a SVN dir? -ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) -# Find if the local source if modified -REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) -# Find the revision like: rXXXX-branch -REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') -endif -endif -# Make sure we have something in REV -ifeq ($(REV),) -REV := norev000 -endif - -ifndef BUNDLE_NAME -BUNDLE_NAME = OTTD-$(OS)-custom-$(REV) -endif - -# An OSX application bundle needs the data files, lang files and openttd executable in a different location. -ifdef OSXAPP -DATA_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/data -LANG_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/lang -TTD_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/MacOS -else -DATA_DIR = $(BUNDLE_DIR)/data -LANG_DIR = $(BUNDLE_DIR)/lang -TTD_DIR = $(BUNDLE_DIR) -endif - -bundle: all - @echo '[BUNDLE] Constructing bundle' - $(Q)rm -rf "${BUNDLE_DIR}" - $(Q)mkdir -p "${BUNDLE_DIR}" - $(Q)mkdir -p "$(BUNDLE_DIR)/docs" - $(Q)mkdir -p "$(BUNDLE_DIR)/scenario" - $(Q)mkdir -p "$(BUNDLE_DIR)/scenario/heightmap" - $(Q)mkdir -p "$(BUNDLE_DIR)/media" - $(Q)mkdir -p "$(TTD_DIR)" - $(Q)mkdir -p "$(DATA_DIR)" - $(Q)mkdir -p "$(LANG_DIR)" -ifdef OSXAPP - $(Q)mkdir -p "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources" - $(Q)echo "APPL????" > "$(BUNDLE_DIR)/$(OSXAPP)/Contents/PkgInfo" - $(Q)cp "$(ROOT_DIR)/os/macosx/openttd.icns" "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/openttd.icns" - $(Q)$(ROOT_DIR)/os/macosx/plistgen.sh "${BUNDLE_DIR}/$(OSXAPP)" "$(REV)" - $(Q)cp "$(ROOT_DIR)/docs/OSX_install_instructions.txt" "$(BUNDLE_DIR)/docs/" - $(Q)cp "$(ROOT_DIR)/os/macosx/splash.png" "$(DATA_DIR)" -endif - $(Q)cp "$(BIN_DIR)/$(TTD)" "$(TTD_DIR)/" - $(Q)cp "$(BIN_DIR)/data/"*.grf "$(DATA_DIR)/" - $(Q)cp "$(BIN_DIR)/data/opntitle.dat" "$(DATA_DIR)/" - $(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/" - $(Q)cp "$(ROOT_DIR)/readme.txt" "$(BUNDLE_DIR)/" - $(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/" - $(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/docs/" - $(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/" - $(Q)cp "$(ROOT_DIR)/docs/32bpp.txt" "$(BUNDLE_DIR)/docs/" - $(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/docs/" - $(Q)cp "$(ROOT_DIR)/media/openttd.64.png" "$(BUNDLE_DIR)/media/" - $(Q)cp "$(ROOT_DIR)/media/openttd.32.xpm" "$(BUNDLE_DIR)/media/" - $(Q)cp "$(ROOT_DIR)/media/openttd.32.bmp" "$(BUNDLE_DIR)/media/" -ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/\"*.scn 2> /dev/null`"; then echo 1; fi), 1) - $(Q)cp "$(BIN_DIR)/scenario/"*.scn "$(BUNDLE_DIR)/scenario/" -endif -ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/heightmaps/\"* 2>/dev/null`"; then echo 1; fi), 1) - $(Q)cp "$(BIN_DIR)/scenario/heightmaps/"* "$(BUNDLE_DIR)/scenario/heightmap/" -endif -ifeq ($(TTD), openttd.exe) - $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" -endif - -### Packing the current bundle into several compressed file formats ### -# -# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg. -# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle. -# -# One can supply a custom name by adding BUNDLE_NAME:= to the make command. -# -bundle_zip: bundle - @echo '[BUNDLE] Creating $(BUNDLE_NAME).zip' - $(Q)mkdir -p "$(BUNDLES_DIR)" - $(Q)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" . - -bundle_gzip: bundle - @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz' - $(Q)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)" - $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/" - $(Q)cd "$(BUNDLES_DIR)/.gzip" && tar -zc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.gz" "$(BUNDLE_NAME)" - $(Q)rm -rf "$(BUNDLES_DIR)/.gzip" - -bundle_bzip2: bundle - @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2' - $(Q)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)" - $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/" - $(Q)cd "$(BUNDLES_DIR)/.bzip2" && tar -jc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.bz2" "$(BUNDLE_NAME)" - $(Q)rm -rf "$(BUNDLES_DIR)/.bzip2" - -bundle_lha: bundle - @echo '[BUNDLE] Creating $(BUNDLE_NAME).lha' - $(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)" - $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/" - $(Q)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)" - $(Q)rm -rf "$(BUNDLES_DIR)/.lha" - -bundle_dmg: bundle - @echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg' - $(Q)mkdir -p "$(BUNDLES_DIR)/OpenTTD $(REV)" - $(Q)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/OpenTTD $(REV)" - $(Q)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/OpenTTD $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg" - $(Q)rm -fr "$(BUNDLES_DIR)/OpenTTD $(REV)" - -ifdef OSXAPP -install: - @echo '[INSTALL] Cannot install the OSX Application Bundle' -else -install: bundle - @echo '[INSTALL] Installing OpenTTD' - $(Q)install -d "$(INSTALL_BINARY_DIR)" - $(Q)install -d "$(INSTALL_ICON_DIR)" - $(Q)install -d "$(INSTALL_DATA_DIR)/gm" - $(Q)install -d "$(INSTALL_DATA_DIR)/data" - $(Q)install -d "$(INSTALL_DATA_DIR)/lang" - $(Q)install -d "$(INSTALL_DATA_DIR)/docs" - $(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)" - $(Q)install -m 644 "$(BUNDLE_DIR)/lang/"* "$(INSTALL_DATA_DIR)/lang" - $(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data" - $(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs" - $(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)" - $(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)" -endif # OSXAPP +include Makefile.bundle diff --git a/Makefile.msvc b/Makefile.msvc new file mode 100644 index 0000000000..d6821a905e --- /dev/null +++ b/Makefile.msvc @@ -0,0 +1,28 @@ +# +# Makefile for creating bundles of MSVC's binaries in the same way as we make +# the zip bundles for ALL other OSes. +# +# Usage: make -f Makefile.msvc PLATFORM=[Win32|x64] BUNDLE_NAME=openttd--win[32|64] +# or make -f Makefile.msvc PLATFORM=[Win32|x64] BUNDLE_NAME=OTTD-win[32|64]-nightly- +# + +# Check if we want to show what we are doing +ifdef VERBOSE + Q = +else + Q = @ +endif + +AWK = "awk" +ROOT_DIR := $(shell pwd) +BIN_DIR = "$(ROOT_DIR)/bin" +SRC_DIR = "$(ROOT_DIR)/src" +BUNDLE_DIR = "$(ROOT_DIR)/bundle" +BUNDLES_DIR = "$(ROOT_DIR)/bundles" +TTD = "openttd.exe" +TARGET := $(shell echo $(PLATFORM) | sed "s/win64/x64/;s/win32/Win32/") + +all: + $(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD) + +include Makefile.bundle diff --git a/Makefile.src.in b/Makefile.src.in index 9ca235d5b8..d2b83fcf8d 100644 --- a/Makefile.src.in +++ b/Makefile.src.in @@ -89,6 +89,32 @@ $(LANG_OBJS_DIR)/$(STRGEN): $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN) $(MAKE) -C $(LANG_OBJS_DIR) table/strings.h + +# Determine if we are using a modified version +ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) +REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) +else +# Are we a git dir? +ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1) +REV_MODIFIED := $(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi) +else +# Are we a hg (Mercurial) dir? +ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1) +REV_MODIFIED := $(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi) +else +MODIFIED="1" +endif +endif +endif + +ifneq ($(MODIFIED),"1") +ifeq ($(REV_MODIFIED),) +MODIFIED="0" +else +MODIFIED="2" +endif +endif + # Make the revision number ifdef REVISION REV := $(REVISION) @@ -97,30 +123,31 @@ else # Are we a SVN dir? ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1) # Find if the local source if modified -REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' ) -# Find the revision like: rXXXX-branch -REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') +# Find the revision like: rXXXXM-branch +REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); for(i in a) if (a[i]=="branches") { BRANCH="-"a[i+1]; break } } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }') REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }') else # Are we a git dir? ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1) # Find the revision like: gXXXXM-branch -REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//') +REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(REV_MODIFIED)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//') REV_NR := $(shell LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" ) else # Are we a hg (Mercurial) dir? ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1) # Find the revision like: hXXXXM-branch -REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)$(shell hg branch | sed 's/^/-/;s/^-default$$//') +REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -d: -f3 | cut -c1-8; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//') REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" ) endif endif endif endif -# Make sure we have something in REV +# Make sure we have something in REV and REV_NR ifeq ($(REV),) REV := norev000 +endif +ifeq ($(REV_NR),) REV_NR := 0 endif @@ -132,7 +159,7 @@ RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORC # If there is a change in the source-file-list, make sure we recheck the deps RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi ) # If there is a change in the revision, make sure we recompile rev.cpp -RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV)" ]; then echo "$(REV)" > $(CONFIG_CACHE_VERSION); fi ) +RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV) $(MODIFIED)" ]; then echo "$(REV) $(MODIFIED)" > $(CONFIG_CACHE_VERSION); fi ) ifndef MAKEDEPEND # The slow, but always correct, dep-check @@ -287,7 +314,7 @@ $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp # Revision files $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in - $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp + $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@MODIFIED@@#$(MODIFIED)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp $(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in $(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/ottdres.rc diff --git a/config.lib b/config.lib index 48ad17c0fe..8e02959ce4 100644 --- a/config.lib +++ b/config.lib @@ -28,10 +28,15 @@ set_default() { prefix_dir="/usr/local" binary_dir="games" data_dir="share/games/openttd" + doc_dir="1" icon_dir="share/pixmaps" + icon_theme_dir="1" personal_dir="1" shared_dir="1" install_dir="/" + man_dir="1" + menu_dir="1" + menu_group="Game;" enable_debug="0" enable_desync_debug="0" enable_profiling="0" @@ -48,6 +53,7 @@ set_default() { enable_cocoa_quickdraw="1" with_osx_sysroot="1" with_application_bundle="1" + with_menu_entry="1" with_sdl="1" with_cocoa="1" with_zlib="1" @@ -85,10 +91,15 @@ set_default() { prefix_dir binary_dir data_dir + doc_dir icon_dir + icon_theme_dir + man_dir + menu_dir personal_dir shared_dir install_dir + menu_group enable_debug enable_desync_debug enable_profiling @@ -188,9 +199,23 @@ detect_params() { --data-dir) prevp_p="data-dir";; --data-dir=*) data_dir="$optarg";; + --doc-dir) prevp_p="doc-dir";; + --doc-dir=*) doc_dir="$optarg";; + --icon-dir) prevp_p="icon-dir";; --icon-dir=*) icon_dir="$optarg";; + --icon-theme-dir) prevp_p="icon-theme-dir";; + --icon-theme-dir=*) icon_theme_dir="$optarg";; + --without-icon-theme) icon_theme_dir="";; + + --menu-dir) prevp_p="menu_dir";; + --menu-dir=*) menu_dir="$optarg";; + --without-menu-entry) menu_dir="";; + + --man-dir) prevp_p="man_dir";; + --man-dir=*) man_dir="$optarg";; + --personal-dir) prevp_p="personal-dir";; --personal-dir=*) personal_dir="$optarg";; --without-personal-dir) personal_dir="";; @@ -204,6 +229,11 @@ detect_params() { + --menu-group) prevp_p="menu_group";; + --menu-group=*) menu_group="$optarg";; + + + --enable-debug) enable_debug="1";; --enable-debug=*) enable_debug="$optarg";; --enable-desync-debug) enable_desync_debug="1";; @@ -392,9 +422,9 @@ check_params() { exit 1 fi # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP - if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then + if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then echo "configure: error: invalid option --os=$os" - echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]" + echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]" exit 1 fi # cpu_type can be either 32 or 64 @@ -736,7 +766,7 @@ check_params() { # First, are we a real OSX system, else we can't detect it native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin` # If $host doesn't match $build , we are cross-compiling - if [ -n "$native" ] && [ "$build" == "$host" ]; then + if [ -n "$native" ] && [ "$build" = "$host" ]; then $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector res=`./G5_detector` rm -f G5_detector @@ -809,6 +839,22 @@ check_params() { fi fi + if [ "$doc_dir" = "1" ]; then + if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then + doc_dir="share/doc/openttd" + else + doc_dir="$data_dir/docs" + fi + fi + + if [ "$icon_theme_dir" = "1" ]; then + if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then + icon_theme_dir="share/icons/hicolor" + else + icon_theme_dir="" + fi + fi + if [ "$personal_dir" = "1" ]; then if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then personal_dir="OpenTTD" @@ -828,6 +874,24 @@ check_params() { fi fi + if [ "$man_dir" = "1" ]; then + # add manpage on UNIX systems + if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then + man_dir="share/man/man6" + else + man_dir="" + fi + fi + + if [ "$menu_dir" = "1" ]; then + # add a freedesktop menu item only for some UNIX systems + if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then + menu_dir="share/applications" + else + menu_dir="" + fi + fi + # "set_universal_binary_flags" needs to be before "detect_iconv" set_universal_binary_flags detect_iconv @@ -852,6 +916,27 @@ check_params() { else log 1 "installation directory... none" fi + + if [ -n "$icon_theme_dir" ] + then + log 1 "icon theme directory... $icon_theme_dir" + else + log 1 "icon theme directory... none" + fi + + if [ -n "$man_dir" ] + then + log 1 "manual page directory... $man_dir" + else + log 1 "manual page directory... none" + fi + + if [ -n "$menu_dir" ] + then + log 1 "menu item directory... $menu_dir" + else + log 1 "menu item directory... none" + fi } make_cflags_and_ldflags() { @@ -883,7 +968,7 @@ make_cflags_and_ldflags() { else OBJS_SUBDIR="debug" - # Each debug level reduces the optimalization by a bit + # Each debug level reduces the optimization by a bit if [ $enable_debug -ge 1 ]; then CFLAGS="$CFLAGS -g -D_DEBUG" if [ "$os" = "PSP" ]; then @@ -934,10 +1019,20 @@ make_cflags_and_ldflags() { # Make sure we mark GCC 2.95 flag for Makefile.src.in, as we # need a lovely hack there to make it compile correctly. gcc295="1" + + # Disable warnings about unused variables when + # compiling with asserts disabled + if [ $enable_assert -eq 0 ]; then + CFLAGS="$CFLAGS -Wno-unused" + fi fi if [ $cc_version -ge 30 ]; then CFLAGS="$CFLAGS -W -Wno-unused-parameter" + # Do not warn about unused variables when building without asserts + if [ $enable_assert -eq 0 ]; then + CFLAGS="$CFLAGS -Wno-unused-variable" + fi fi if [ $cc_version -ge 34 ]; then @@ -977,7 +1072,6 @@ make_cflags_and_ldflags() { if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then LIBS="$LIBS -lpthread" - LIBS="$LIBS -lrt" fi if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "WINCE" ]; then @@ -1019,7 +1113,7 @@ make_cflags_and_ldflags() { fi # Most targets act like UNIX, just with some additions - if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then + if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then CFLAGS="$CFLAGS -DUNIX" fi # And others like Windows @@ -1542,7 +1636,7 @@ detect_awk() { detect_os() { if [ "$os" = "DETECT" ]; then - # Detect UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP + # Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP # Try first via dumpmachine, then via uname os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk ' @@ -1550,6 +1644,8 @@ detect_os() { /darwin/ { print "OSX"; exit} /freebsd/ { print "FREEBSD"; exit} /openbsd/ { print "OPENBSD"; exit} + /netbsd/ { print "NETBSD"; exit} + /hp-ux/ { print "HPUX"; exit} /morphos/ { print "MORPHOS"; exit} /beos/ { print "BEOS"; exit} /sunos/ { print "SUNOS"; exit} @@ -1567,6 +1663,8 @@ detect_os() { /darwin/ { print "OSX"; exit} /freebsd/ { print "FREEBSD"; exit} /openbsd/ { print "OPENBSD"; exit} + /netbsd/ { print "NETBSD"; exit} + /hp-ux/ { print "HPUX"; exit} /morphos/ { print "MORPHOS"; exit} /beos/ { print "BEOS"; exit} /sunos/ { print "SUNOS"; exit} @@ -1579,7 +1677,7 @@ detect_os() { if [ -z "$os" ]; then log 1 "detecting OS... none detected" log 1 "I couldn't detect your OS. Please use --os=OS to force one" - log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP" + log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP" exit 1 fi @@ -2193,7 +2291,10 @@ make_sed() { s#!!TTD!!#$TTD#g; s#!!BINARY_DIR!!#$prefix_dir/$binary_dir#g; s#!!DATA_DIR!!#$prefix_dir/$data_dir#g; + s#!!DOC_DIR!!#$prefix_dir/$doc_dir#g; + s#!!MAN_DIR!!#$prefix_dir/$man_dir#g; s#!!ICON_DIR!!#$prefix_dir/$icon_dir#g; + s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g; s#!!PERSONAL_DIR!!#$personal_dir#g; s#!!SHARED_DIR!!#$shared_dir#g; s#!!INSTALL_DIR!!#$install_dir#g; @@ -2223,6 +2324,45 @@ make_sed() { s#!!GCC295!!#$gcc295#g; s#!!DISTCC!!#$distcc#g; " + + if [ "$icon_theme_dir" != "" ]; then + SRC_REPLACE="$SRC_REPLACE + s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g; + " + else + SRC_REPLACE="$SRC_REPLACE + s#!!ICON_THEME_DIR!!##g; + " + fi + + if [ "$man_dir" != "" ]; then + SRC_REPLACE="$SRC_REPLACE + s#!!MAN_DIR!!#$prefix_dir/$man_dir#g; + " + else + SRC_REPLACE="$SRC_REPLACE + s#!!MAN_DIR!!##g; + " + fi + + if [ "$menu_dir" != "" ]; then + SRC_REPLACE="$SRC_REPLACE + s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g; + " + else + SRC_REPLACE="$SRC_REPLACE + s#!!MENU_DIR!!##g; + " + fi +} + +generate_menu_item() { + MENU_REPLACE=" + s#!!TTD!!#$TTD#g; + s#!!MENU_GROUP!!#$menu_group#g + " + echo "Generating menu item..." + < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop } generate_main() { @@ -2239,6 +2379,10 @@ generate_main() { cp $SOURCE_LIST config.cache.source.list # Make sure config.cache is OLDER then config.cache.source.list touch config.cache + + if [ "$menu_dir" != "" ]; then + generate_menu_item + fi } generate_lang() { @@ -2319,40 +2463,53 @@ showhelp() { echo " --strip=STRIP the strip to use [HOST-strip]" echo " --awk=AWK the awk to use in configure [awk]" echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]" - echo " --os=OS the OS we are compiling for [DETECT]" - echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/MORPHOS/" - echo " BEOS/SUNOS/CYGWIN/MINGW/OS2/WINCE/PSP" + echo " --os=OS the OS we are compiling for [$os]" + echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/" + echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/" + echo " WINCE/PSP" echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)" echo " --revision=rXXXX overwrite the revision detection." echo " Use with care!" echo "" echo "Paths:" echo " --prefix-dir=dir specifies the prefix for all installed" - echo " files [/usr/local]" + echo " files [$prefix_dir]" echo " --binary-dir=dir location of the binary. Will be prefixed" - echo " with the prefix-dir [games]" + echo " with the prefix-dir [$binary_dir]" echo " --data-dir=dir location of data files (lang, data, gm)." echo " Will be prefixed with the prefix-dir" - echo " [share/games/openttd]" + echo " [$data_dir]" + echo " --doc-dir=dir location of the doc files" + echo " Will be prefixed with the prefix-dir" + echo " [$doc_dir]" echo " --icon-dir=dir location of icons. Will be prefixed" - echo " with the prefix-dir [share/pixmaps]" + echo " with the prefix-dir [$icon_dir]" + echo " --icon-theme-dir=dir location of icon theme." + echo " Will be prefixed with the prefix-dir" + echo " and postfixed with size-dirs [$icon_theme_dir]" + echo " --man-dir=dir location of the manual page (UNIX only)" + echo " Will be prefixed with the prefix-dir" + echo " [$man_dir]" + echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)" + echo " Will be prefixed with the prefix-dir" + echo " [$menu_dir]" echo " --personal-dir=dir location of the personal directory" - echo " [os-dependent default]" + echo " [$personal_dir]" echo " --shared-dir=dir location of shared data files" - echo " [os-dependent default]" + echo " [$shared_dir]" echo " --install-dir=dir specifies the root to install to." - echo " Useful to install into jails [/]" + echo " Useful to install into jails [$install_dir]" echo "" echo "Features and packages:" echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)" - echo " --enable_desync_debug=[LVL] enable desync debug options (LVL=[012], 0 is none" + echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none" echo " --enable-profiling enables profiling" echo " --enable-dedicated compile a dedicated server (without video)" echo " --enable-static enable static compile (doesn't work for" echo " all HOSTs)" echo " --enable-translator enable extra output for translators" echo " --enable-universal enable universal builds (OSX ONLY)" - echo " --enable-osx-g5 enables optimalizations for G5 (OSX ONLY)" + echo " --enable-osx-g5 enables optimizations for G5 (OSX ONLY)" echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)" echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)" echo " --disable-unicode disable unicode support to build win9x" @@ -2364,6 +2521,8 @@ showhelp() { echo " (OSX ONLY)" echo " --without-application-bundle disable generation of application bundle" echo " (OSX ONLY)" + echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)" + echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)" echo " --with-direct-music enable direct music support (Win32 ONLY)" echo " --with-sort=sort define a non-default location for sort" echo " --with-midi=midi define which midi-player to use" diff --git a/configure b/configure index 1c6aaa7191..1a0ce895d1 100755 --- a/configure +++ b/configure @@ -17,7 +17,7 @@ ROOT_DIR="`dirname $0`" ROOT_DIR="`cd $ROOT_DIR && pwd`" PWD="`pwd`" -PREFIX="`pwd`/bin" +PREFIX="$PWD/bin" . $ROOT_DIR/config.lib @@ -32,7 +32,7 @@ MEDIA_DIR="$ROOT_DIR/media" SOURCE_LIST="$ROOT_DIR/source.list" if [ "$1" = "--reconfig" ] || [ "$1" = "--reconfigure" ]; then - if ! [ -f "config.cache" ]; then + if [ ! -f "config.cache" ]; then echo "can't reconfigure, because never configured before" exit 1 fi @@ -64,7 +64,7 @@ else PIPE_SORT="$sort" fi -if ! [ -f "$LANG_DIR/english.txt" ]; then +if [ ! -f "$LANG_DIR/english.txt" ]; then echo "Languages not found in $LANG_DIR. Can't continue without it." echo "Please make sure the dir exists and contains at least english.txt" fi diff --git a/media/openttd.desktop.in b/media/openttd.desktop.in new file mode 100644 index 0000000000..4ad20ca4c8 --- /dev/null +++ b/media/openttd.desktop.in @@ -0,0 +1,13 @@ +# $Id$ +# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Version=1.1 +Name=OpenTTD +GenericName=A clone of Transport Tycoon Deluxe +Comment=A business simulation game +Icon=openttd +Exec=!!TTD!! +Terminal=false +Categories=!!MENU_GROUP!! diff --git a/os/win32/installer/install.nsi b/os/win32/installer/install.nsi index d5dce45d02..8a1ab4ebca 100644 --- a/os/win32/installer/install.nsi +++ b/os/win32/installer/install.nsi @@ -1,6 +1,7 @@ !define APPNAME "OpenTTD" ; Define application name !define APPVERSION "0.6.2" ; Define application version !define INSTALLERVERSION 51 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!! +!include ${VERSION_INCLUDE} !define APPURLLINK "http://www.openttd.org" !define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}" @@ -18,21 +19,20 @@ SetCompressor LZMA ; Version Info Var AddWinPrePopulate VIProductVersion "${APPVERSIONINTERNAL}" -VIAddVersionKey "ProductName" "OpenTTD Installer" +VIAddVersionKey "ProductName" "OpenTTD Installer ${APPBITS} bits version ${EXTRA_VERSION}" VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}" VIAddVersionKey "CompanyName" "OpenTTD Developers" VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}" VIAddVersionKey "ProductVersion" "${APPVERSION}" -VIAddVersionKey "InternalName" "InstOpenTTD" -VIAddVersionKey "FileVersion" "${APPVERSION}" +VIAddVersionKey "InternalName" "InstOpenTTD-${APPARCH}" +VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}" VIAddVersionKey "LegalCopyright" " " ; Main Install settings -Name "${APPNAMEANDVERSION}" +Name "${APPNAMEANDVERSION} ${APPBITS} bits version ${EXTRA_VERSION}" ; NOTE: Keep trailing backslash! -InstallDir "$PROGRAMFILES\OpenTTD\" InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" -OutFile "openttd-${APPVERSION}-win32.exe" +OutFile "openttd-${APPVERSION}-${APPARCH}.exe" CRCCheck force ShowInstDetails show @@ -45,7 +45,7 @@ Var CDDRIVE !include "MUI.nsh" !define MUI_ABORTWARNING - +!define MUI_WELCOMEPAGE_TITLE_3LINES !insertmacro MUI_PAGE_WELCOME !define MUI_LICENSEPAGE_RADIOBUTTONS @@ -75,6 +75,8 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder" ; New custom page to show UNICODE and MSLU information Page custom ShowWarningsPage +!define MUI_FINISHPAGE_TITLE_3LINES +!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!" !define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe" !define MUI_FINISHPAGE_LINK "Visit the OpenTTD site for latest news, FAQs and downloads" !define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}" @@ -84,6 +86,7 @@ Page custom ShowWarningsPage !define MUI_WELCOMEFINISHPAGE_CUSTOMFUNCTION_INIT DisableBack !insertmacro MUI_PAGE_FINISH +!define MUI_PAGE_HEADER_TEXT "Uninstall ${APPNAMEANDVERSION}" !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES @@ -103,7 +106,6 @@ Section "!OpenTTD" Section1 ; Copy language files SetOutPath "$INSTDIR\lang\" File ${PATH_ROOT}bin\lang\*.lng - File ${PATH_ROOT}src\lang\english.txt ; Copy data files SetOutPath "$INSTDIR\data\" @@ -127,8 +129,7 @@ Section "!OpenTTD" Section1 File ${PATH_ROOT}known-bugs.txt ; Copy executable - File /oname=openttd.exe ${PATH_ROOT}objs\Win32\Release\openttd.exe - File ${PATH_ROOT}objs\strgen\strgen.exe + File /oname=openttd.exe ${BINARY_DIR}\openttd.exe ; Delete old files from the main dir. they are now placed in data/ and lang/ @@ -245,10 +246,10 @@ Section "Uninstall" Delete "$INSTDIR\readme.txt" Delete "$INSTDIR\known-bugs.txt" Delete "$INSTDIR\openttd.exe" - Delete "$INSTDIR\strgen.exe" Delete "$INSTDIR\COPYING" Delete "$INSTDIR\INSTALL.LOG" Delete "$INSTDIR\crash.log" + Delete "$INSTDIR\crash.dmp" Delete "$INSTDIR\openttd.cfg" Delete "$INSTDIR\hs.dat" Delete "$INSTDIR\cached_sprites.*" @@ -267,6 +268,8 @@ Section "Uninstall" Delete "$INSTDIR\data\openttd.grf" Delete "$INSTDIR\data\roadstops.grf" Delete "$INSTDIR\data\trkfoundw.grf" + Delete "$INSTDIR\data\openttdd.grf" + Delete "$INSTDIR\data\openttdw.grf" Delete "$INSTDIR\data\sample.cat" ; Windows Data files @@ -287,7 +290,6 @@ Section "Uninstall" ; Language files Delete "$INSTDIR\lang\*.lng" - Delete "$INSTDIR\lang\english.txt" ; Remove remaining directories RMDir "$SMPROGRAMS\$SHORTCUTS\Extras\" @@ -388,14 +390,55 @@ Function GetWindowsVersion ClearErrors StrCpy $R0 "winnt" - ReadRegStr $R1 HKLM "SOFTWARE\MICROSOFT\WINDOWS NT\CurrentVersion" CurrentVersion - IfErrors 0 WinNT + GetVersion::WindowsPlatformId + Pop $R0 + IntCmp $R0 2 WinNT 0 StrCpy $R0 "win9x" WinNT: ClearErrors Push $R0 FunctionEnd +;------------------------------------------------------------------------------- +; Check whether we're not running an installer for 64 bits on 32 bits and vice versa +Function CheckProcessorArchitecture + GetVersion::WindowsPlatformArchitecture + Pop $R0 + IntCmp $R0 64 Win64 0 + ClearErrors + IntCmp ${APPBITS} 64 0 Done + MessageBox MB_OKCANCEL|MB_ICONSTOP "You want to install the 64 bits OpenTTD on a 32 bits Operating System. This is not going to work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort + GoTo Done +Win64: + ClearErrors + IntCmp ${APPBITS} 64 Done 0 + MessageBox MB_OKCANCEL|MB_ICONINFORMATION "You want to install the 32 bits OpenTTD on a 64 bits Operating System. This is not adviced, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort + GoTo Done +Abort: + Quit +Done: +FunctionEnd + + +;------------------------------------------------------------------------------- +; Check whether we're not running an installer for NT on 9x and vice versa +Function CheckWindowsVersion + Call GetWindowsVersion + Pop $R0 + StrCmp $R0 "win9x" 0 WinNT + ClearErrors + StrCmp ${APPARCH} "win9x" Done 0 + MessageBox MB_OKCANCEL|MB_ICONSTOP "You want to install the Windows 2000, XP and Vista version on Windows 95, 98 or ME. This is will not work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort + GoTo Done +WinNT: + ClearErrors + StrCmp ${APPARCH} "win9x" 0 Done + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You want to install the Windows 95, 98 and ME version on Windows 2000, XP or Vista. This is not adviced, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort +Abort: + Quit +Done: +FunctionEnd + Var OLDVERSION Var UninstallString @@ -446,6 +489,8 @@ InstallerIsOlder: FinishCallback: ClearErrors + Call CheckProcessorArchitecture + Call CheckWindowsVersion FunctionEnd ; eof diff --git a/os/win32/installer/version_win32.txt b/os/win32/installer/version_win32.txt new file mode 100644 index 0000000000..ed7f77e3df --- /dev/null +++ b/os/win32/installer/version_win32.txt @@ -0,0 +1,5 @@ +!define APPBITS 32 ; Define number of bits for the architecture +!define EXTRA_VERSION "for Windows 2000, XP and Vista" +!define APPARCH "win32" ; Define the application architecture +!define BINARY_DIR "${PATH_ROOT}objs\win32\Release" +InstallDir "$PROGRAMFILES32\OpenTTD\" diff --git a/os/win32/installer/version_win64.txt b/os/win32/installer/version_win64.txt new file mode 100644 index 0000000000..3c84447b60 --- /dev/null +++ b/os/win32/installer/version_win64.txt @@ -0,0 +1,5 @@ +!define APPBITS 64 ; Define number of bits for the architecture +!define EXTRA_VERSION "for Windows XP and Vista" +!define APPARCH "win64" ; Define the application architecture +!define BINARY_DIR "${PATH_ROOT}objs\x64\Release" +InstallDir "$PROGRAMFILES64\OpenTTD\" diff --git a/os/win32/installer/version_win9x.txt b/os/win32/installer/version_win9x.txt new file mode 100644 index 0000000000..be20888e59 --- /dev/null +++ b/os/win32/installer/version_win9x.txt @@ -0,0 +1,5 @@ +!define APPBITS 32 ; Define number of bits for the architecture +!define EXTRA_VERSION "for Windows 95, 98 and ME" +!define APPARCH "win9x" ; Define the application architecture +!define BINARY_DIR "${PATH_ROOT}bin" +InstallDir "$PROGRAMFILES32\OpenTTD\" diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index 3ac5852f5a..2920e958db 100755 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -9,28 +9,33 @@ Sub FindReplaceInFile(filename, to_find, replacement) data = file.ReadAll file.Close data = Replace(data, to_find, replacement) - Set file = FSO.CreateTextFile(FileName, -1, 0) + Set file = FSO.CreateTextFile(filename, -1, 0) file.Write data file.Close End Sub -Sub UpdateFile(revision, version, cur_date, filename) +Sub UpdateFile(modified, revision, version, cur_date, filename) FSO.CopyFile filename & ".in", filename + FindReplaceInFile filename, "@@MODIFIED@@", modified FindReplaceInFile filename, "@@REVISION@@", revision FindReplaceInFile filename, "@@VERSION@@", version FindReplaceInFile filename, "@@DATE@@", cur_date End Sub Sub UpdateFiles(version) - Dim WshShell, cur_date, revision, oExec + Dim WshShell, cur_date, modified, revision, oExec Set WshShell = CreateObject("WScript.Shell") cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date) revision = 0 + modified = 1 Select Case Mid(version, 1, 1) Case "r" ' svn revision = Mid(version, 2) If InStr(revision, "M") Then revision = Mid(revision, 1, InStr(revision, "M") - 1) + modified = 2 + Else + modified = 0 End If If InStr(revision, "-") Then revision = Mid(revision, 1, InStr(revision, "-") - 1) @@ -49,8 +54,8 @@ Sub UpdateFiles(version) End If End Select - UpdateFile revision, version, cur_date, "../src/rev.cpp" - UpdateFile revision, version, cur_date, "../src/ottdres.rc" + UpdateFile modified, revision, version, cur_date, "../src/rev.cpp" + UpdateFile modified, revision, version, cur_date, "../src/ottdres.rc" End Sub Function ReadRegistryKey(shive, subkey, valuename, architecture) @@ -136,6 +141,11 @@ Function DetermineSVNVersion() ' Do we have subversion installed? Check immediatelly whether we've got a modified WC. Set oExec = WshShell.Exec("svnversion ../src") If Err.Number = 0 Then + ' Wait till the application is finished ... + Do While oExec.Status = 0 + Loop + End If + If Err.Number = 0 And oExec.ExitCode = 0 Then Dim modified If InStr(OExec.StdOut.ReadLine(), "M") Then modified = "M" @@ -173,6 +183,11 @@ Function DetermineSVNVersion() Err.Clear Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD") If Err.Number = 0 Then + ' Wait till the application is finished ... + Do While oExec.Status = 0 + Loop + End If + If Err.Number = 0 And oExec.ExitCode = 0 Then version = "g" & oExec.StdOut.ReadLine() Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src") Do While oExec.Status = 0 And Err.Number = 0 @@ -184,7 +199,7 @@ Function DetermineSVNVersion() Set oExec = WshShell.Exec("git symbolic-ref HEAD") If Err.Number = 0 Then line = oExec.StdOut.ReadLine() - line = Mid(line, InStrRev(line, "/")+1) + line = Mid(line, InStrRev(line, "/") + 1) If line <> "master" Then version = version & "-" & line End If @@ -194,12 +209,18 @@ Function DetermineSVNVersion() Err.Clear Set oExec = WshShell.Exec("hg tip") If Err.Number = 0 Then - version = "h" & Mid(OExec.StdOut.ReadLine(), 19, 8) + ' Wait till the application is finished ... + Do While oExec.Status = 0 + Loop + End If + If Err.Number = 0 And oExec.ExitCode = 0 Then + line = OExec.StdOut.ReadLine() + version = "h" & Mid(line, InStrRev(line, ":") + 1, 8) Set oExec = WshShell.Exec("hg status ../src") If Err.Number = 0 Then Do line = OExec.StdOut.ReadLine() - If Mid(line, 1, 1) <> "?" Then + If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then version = version & "M" Exit Do End If