truebrain@10057: # truebrain@10057: # Creation of bundles truebrain@10057: # truebrain@10057: truebrain@10057: # The revision is needed for the bundle name and creating an OSX application bundle. truebrain@10057: ifdef REVISION truebrain@10057: REV := $(REVISION) truebrain@10057: else matthijs@10086: # Detect the revision matthijs@10086: VERSIONS := $(shell AWK="$(AWK)" "$(ROOT_DIR)/findversion.sh") matthijs@10091: REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ') truebrain@10057: endif matthijs@10086: truebrain@10057: # Make sure we have something in REV truebrain@10057: ifeq ($(REV),) truebrain@10057: REV := norev000 truebrain@10057: endif truebrain@10057: truebrain@10057: ifndef BUNDLE_NAME rubidium@10166: BUNDLE_NAME = openttd-custom-$(REV)-$(OS) truebrain@10057: endif truebrain@10057: truebrain@10057: # An OSX application bundle needs the data files, lang files and openttd executable in a different location. truebrain@10057: ifdef OSXAPP truebrain@10057: DATA_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/data truebrain@10057: LANG_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/lang truebrain@10057: TTD_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/MacOS truebrain@10057: else truebrain@10057: DATA_DIR = $(BUNDLE_DIR)/data truebrain@10057: LANG_DIR = $(BUNDLE_DIR)/lang truebrain@10057: TTD_DIR = $(BUNDLE_DIR) truebrain@10057: endif truebrain@10057: truebrain@10057: bundle: all truebrain@10057: @echo '[BUNDLE] Constructing bundle' skidd13@10220: $(Q)rm -rf "$(BUNDLE_DIR)" skidd13@10220: $(Q)mkdir -p "$(BUNDLE_DIR)" truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/docs" truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/scenario" truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/scenario/heightmap" truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/media" rubidium@10329: $(Q)mkdir -p "$(BUNDLE_DIR)/scripts" truebrain@10057: $(Q)mkdir -p "$(TTD_DIR)" truebrain@10057: $(Q)mkdir -p "$(DATA_DIR)" truebrain@10057: $(Q)mkdir -p "$(LANG_DIR)" truebrain@10057: ifdef OSXAPP truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources" truebrain@10057: $(Q)echo "APPL????" > "$(BUNDLE_DIR)/$(OSXAPP)/Contents/PkgInfo" truebrain@10057: $(Q)cp "$(ROOT_DIR)/os/macosx/openttd.icns" "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/openttd.icns" skidd13@10220: $(Q)$(ROOT_DIR)/os/macosx/plistgen.sh "$(BUNDLE_DIR)/$(OSXAPP)" "$(REV)" truebrain@10057: $(Q)cp "$(ROOT_DIR)/docs/OSX_install_instructions.txt" "$(BUNDLE_DIR)/docs/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/os/macosx/splash.png" "$(DATA_DIR)" truebrain@10057: endif truebrain@10057: $(Q)cp "$(BIN_DIR)/$(TTD)" "$(TTD_DIR)/" truebrain@10057: $(Q)cp "$(BIN_DIR)/data/"*.grf "$(DATA_DIR)/" truebrain@10057: $(Q)cp "$(BIN_DIR)/data/"*.obg "$(DATA_DIR)/" truebrain@10057: $(Q)cp "$(BIN_DIR)/data/opntitle.dat" "$(DATA_DIR)/" truebrain@10057: $(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/readme.txt" "$(BUNDLE_DIR)/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/" truebrain@10242: $(Q)cp "$(ROOT_DIR)/docs/obg_format.txt" "$(BUNDLE_DIR)/docs/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/docs/32bpp.txt" "$(BUNDLE_DIR)/docs/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/" truebrain@10057: ifdef MAN_DIR truebrain@10057: $(Q)mkdir -p "$(BUNDLE_DIR)/man/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/docs/openttd.6" "$(BUNDLE_DIR)/man/" truebrain@10057: $(Q)gzip "$(BUNDLE_DIR)/man/openttd.6" truebrain@10057: endif truebrain@10057: $(Q)cp "$(ROOT_DIR)/media/openttd.32.xpm" "$(BUNDLE_DIR)/media/" truebrain@10057: $(Q)cp "$(ROOT_DIR)/media/openttd."*.png "$(BUNDLE_DIR)/media/" rubidium@10329: $(Q)cp "$(BIN_DIR)/scripts/"* "$(BUNDLE_DIR)/scripts/" truebrain@10057: ifdef MENU_DIR truebrain@10057: $(Q)cp "$(ROOT_DIR)/media/openttd.desktop" "$(BUNDLE_DIR)/media/" truebrain@10247: $(Q)cat "$(ROOT_DIR)/media/openttd.desktop" | sed s/=openttd/=$(BINARY_NAME)/g > "$(ROOT_DIR)/media/openttd.desktop.install" truebrain@10057: endif truebrain@10057: ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/\"*.scn 2> /dev/null`"; then echo 1; fi), 1) truebrain@10057: $(Q)cp "$(BIN_DIR)/scenario/"*.scn "$(BUNDLE_DIR)/scenario/" truebrain@10057: endif truebrain@10057: ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/heightmaps/\"* 2>/dev/null`"; then echo 1; fi), 1) truebrain@10057: $(Q)cp "$(BIN_DIR)/scenario/heightmaps/"* "$(BUNDLE_DIR)/scenario/heightmap/" truebrain@10057: endif truebrain@10057: ifeq ($(TTD), openttd.exe) truebrain@10057: $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt" rubidium@10385: ifeq ($(OS), DOS) rubidium@10385: $(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi.txt" "$(BUNDLE_DIR)/docs/" rubidium@10385: ifndef STRIP rubidium@10385: $(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi.exe" "$(TTD_DIR)/" rubidium@10385: endif rubidium@10385: endif truebrain@10057: endif truebrain@10057: truebrain@10057: ### Packing the current bundle into several compressed file formats ### truebrain@10057: # truebrain@10057: # Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg. truebrain@10057: # gzip, bzip2 and lha archives have a root folder, with the same name as the bundle. truebrain@10057: # truebrain@10057: # One can supply a custom name by adding BUNDLE_NAME:= to the make command. truebrain@10057: # truebrain@10057: bundle_zip: bundle truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).zip' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)" truebrain@10057: $(Q)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" . truebrain@10057: truebrain@10057: bundle_gzip: bundle truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)" truebrain@10057: $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/" truebrain@10057: $(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)" truebrain@10057: $(Q)rm -rf "$(BUNDLES_DIR)/.gzip" truebrain@10057: truebrain@10057: bundle_bzip2: bundle truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)" truebrain@10057: $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/" truebrain@10057: $(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)" truebrain@10057: $(Q)rm -rf "$(BUNDLES_DIR)/.bzip2" truebrain@10057: truebrain@10057: bundle_lha: bundle truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).lha' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)" truebrain@10057: $(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/" truebrain@10057: $(Q)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)" truebrain@10057: $(Q)rm -rf "$(BUNDLES_DIR)/.lha" truebrain@10057: truebrain@10057: bundle_dmg: bundle truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)/OpenTTD $(REV)" truebrain@10057: $(Q)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/OpenTTD $(REV)" truebrain@10057: $(Q)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/OpenTTD $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg" truebrain@10057: $(Q)rm -fr "$(BUNDLES_DIR)/OpenTTD $(REV)" truebrain@10057: truebrain@10057: bundle_exe: all truebrain@10057: @echo '[BUNDLE] Creating $(BUNDLE_NAME).exe' truebrain@10057: $(Q)mkdir -p "$(BUNDLES_DIR)" truebrain@10057: $(Q)unix2dos "$(ROOT_DIR)/docs/"* "$(ROOT_DIR)/readme.txt" "$(ROOT_DIR)/COPYING" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt" truebrain@10057: $(Q)cd $(ROOT_DIR)/os/win32/installer && makensis.exe //DVERSION_INCLUDE=version_$(PLATFORM).txt install.nsi truebrain@10057: $(Q)mv $(ROOT_DIR)/os/win32/installer/*$(PLATFORM).exe "$(BUNDLES_DIR)/$(BUNDLE_NAME).exe" truebrain@10057: truebrain@10057: ifdef OSXAPP truebrain@10057: install: truebrain@10057: @echo '[INSTALL] Cannot install the OSX Application Bundle' truebrain@10057: else truebrain@10057: install: bundle truebrain@10057: @echo '[INSTALL] Installing OpenTTD' truebrain@10057: $(Q)install -d "$(INSTALL_BINARY_DIR)" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_DIR)" truebrain@10057: $(Q)install -d "$(INSTALL_DATA_DIR)/gm" truebrain@10057: $(Q)install -d "$(INSTALL_DATA_DIR)/data" truebrain@10057: $(Q)install -d "$(INSTALL_DATA_DIR)/lang" rubidium@10335: $(Q)install -d "$(INSTALL_DATA_DIR)/scripts" truebrain@10057: $(Q)install -d "$(INSTALL_DOC_DIR)" truebrain@10244: ifeq ($(TTD), openttd.exe) truebrain@10244: $(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)/${BINARY_NAME}.exe" truebrain@10244: else truebrain@10244: $(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)/${BINARY_NAME}" truebrain@10244: endif truebrain@10057: $(Q)install -m 644 "$(BUNDLE_DIR)/lang/"* "$(INSTALL_DATA_DIR)/lang" truebrain@10057: $(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data" rubidium@10329: $(Q)install -m 644 "$(BUNDLE_DIR)/scripts/"* "$(INSTALL_DATA_DIR)/scripts" truebrain@10057: $(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DOC_DIR)" truebrain@10243: $(Q)install -m 644 "$(BUNDLE_DIR)/"*.txt "$(INSTALL_DOC_DIR)" truebrain@10243: $(Q)install -m 644 "$(BUNDLE_DIR)/COPYING" "$(INSTALL_DOC_DIR)" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.xpm" "$(INSTALL_ICON_DIR)/${BINARY_NAME}.32.xpm" truebrain@10057: ifdef ICON_THEME_DIR truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/16x16/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.16.png" "$(INSTALL_ICON_THEME_DIR)/16x16/apps/${BINARY_NAME}.png" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/32x32/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.png" "$(INSTALL_ICON_THEME_DIR)/32x32/apps/${BINARY_NAME}.png" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/48x48/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.48.png" "$(INSTALL_ICON_THEME_DIR)/48x48/apps/${BINARY_NAME}.png" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/64x64/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.64.png" "$(INSTALL_ICON_THEME_DIR)/64x64/apps/${BINARY_NAME}.png" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/128x128/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.128.png" "$(INSTALL_ICON_THEME_DIR)/128x128/apps/${BINARY_NAME}.png" truebrain@10057: $(Q)install -d "$(INSTALL_ICON_THEME_DIR)/256x256/apps" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.256.png" "$(INSTALL_ICON_THEME_DIR)/256x256/apps/${BINARY_NAME}.png" truebrain@10057: else truebrain@10057: $(Q)install -m 644 "$(BUNDLE_DIR)/media/"*.png "$(INSTALL_ICON_DIR)" truebrain@10057: endif truebrain@10057: ifdef MAN_DIR truebrain@10057: $(Q)install -d "$(INSTALL_MAN_DIR)" truebrain@10244: $(Q)install -m 644 "$(BUNDLE_DIR)/man/openttd.6.gz" "$(INSTALL_MAN_DIR)/${BINARY_NAME}.6.gz" truebrain@10057: endif truebrain@10057: ifdef MENU_DIR truebrain@10057: $(Q)install -d "$(INSTALL_MENU_DIR)" truebrain@10247: $(Q)install -m 644 "$(ROOT_DIR)/media/openttd.desktop.install" "$(INSTALL_MENU_DIR)/${BINARY_NAME}.desktop" truebrain@10057: endif truebrain@10057: $(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)" truebrain@10057: endif # OSXAPP