2009-08-21 20:21:05 +00:00
# $Id$
# This file is part of OpenTTD.
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
2008-08-15 11:58:15 +00:00
#
# Creation of bundles
#
# The revision is needed for the bundle name and creating an OSX application bundle.
2008-09-07 13:36:18 +00:00
# Detect the revision
VERSIONS := $( shell AWK = " $( AWK) " " $( ROOT_DIR) /findversion.sh " )
2008-09-08 06:27:08 +00:00
REV := $( shell echo " $( VERSIONS) " | cut -f 1 -d' ' )
2008-09-07 13:36:18 +00:00
2008-08-15 11:58:15 +00:00
# Make sure we have something in REV
i f e q ( $( REV ) , )
REV := norev000
e n d i f
i f n d e f B U N D L E _ N A M E
2008-09-17 19:32:06 +00:00
BUNDLE_NAME = openttd-custom-$( REV) -$( OS)
2008-08-15 11:58:15 +00:00
e n d i f
# An OSX application bundle needs the data files, lang files and openttd executable in a different location.
i f d e f O S X A P P
2011-11-14 21:38:36 +00:00
AI_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/ai
2013-01-06 16:44:15 +00:00
GAME_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/game
2011-11-14 21:38:36 +00:00
BASESET_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/baseset
LANG_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/Resources/lang
TTD_DIR = $( BUNDLE_DIR) /$( OSXAPP) /Contents/MacOS
2008-08-15 11:58:15 +00:00
e l s e
2011-11-14 21:38:36 +00:00
AI_DIR = $( BUNDLE_DIR) /ai
2013-01-06 16:44:15 +00:00
GAME_DIR = $( BUNDLE_DIR) /game
2011-11-14 21:38:36 +00:00
BASESET_DIR = $( BUNDLE_DIR) /baseset
LANG_DIR = $( BUNDLE_DIR) /lang
TTD_DIR = $( BUNDLE_DIR)
2008-08-15 11:58:15 +00:00
e n d i f
bundle : all
@echo '[BUNDLE] Constructing bundle'
2008-10-06 17:05:44 +00:00
$( Q) rm -rf " $( BUNDLE_DIR) "
$( Q) mkdir -p " $( BUNDLE_DIR) "
2008-08-15 11:58:15 +00:00
$( Q) mkdir -p " $( BUNDLE_DIR) /docs "
$( Q) mkdir -p " $( BUNDLE_DIR) /media "
2008-11-16 13:05:39 +00:00
$( Q) mkdir -p " $( BUNDLE_DIR) /scripts "
2015-08-16 21:01:40 +00:00
$( Q) mkdir -p " $( BUNDLE_DIR) /data "
2008-08-15 11:58:15 +00:00
$( Q) mkdir -p " $( TTD_DIR) "
2009-08-22 19:04:20 +00:00
$( Q) mkdir -p " $( AI_DIR) "
2013-01-06 19:34:13 +00:00
$( Q) mkdir -p " $( GAME_DIR) "
2011-11-14 21:38:36 +00:00
$( Q) mkdir -p " $( BASESET_DIR) "
2008-08-15 11:58:15 +00:00
$( Q) mkdir -p " $( LANG_DIR) "
i f d e f O S X A P P
$( 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 "
2008-10-06 17:05:44 +00:00
$( Q) $( ROOT_DIR) /os/macosx/plistgen.sh " $( BUNDLE_DIR) / $( OSXAPP) " " $( REV) "
2011-11-14 21:38:36 +00:00
$( Q) cp " $( ROOT_DIR) /os/macosx/splash.png " " $( BASESET_DIR) "
2011-09-09 09:13:18 +00:00
e n d i f
i f e q ( $( OS ) , U N I X )
2011-11-14 21:38:36 +00:00
$( Q) cp " $( ROOT_DIR) /media/openttd.32.bmp " " $( BASESET_DIR) / "
2008-08-15 11:58:15 +00:00
e n d i f
$( Q) cp " $( BIN_DIR) / $( TTD) " " $( TTD_DIR) / "
2009-08-22 16:07:39 +00:00
$( Q) cp " $( BIN_DIR) /ai/ " compat_*.nut " $( AI_DIR) / "
2013-01-06 16:44:15 +00:00
$( Q) cp " $( BIN_DIR) /game/ " compat_*.nut " $( GAME_DIR) / "
2011-11-14 21:38:36 +00:00
$( Q) cp " $( BIN_DIR) /baseset/ " *.grf " $( BASESET_DIR) / "
$( Q) cp " $( BIN_DIR) /baseset/ " *.obg " $( BASESET_DIR) / "
$( Q) cp " $( BIN_DIR) /baseset/ " *.obs " $( BASESET_DIR) / "
$( Q) cp " $( BIN_DIR) /baseset/opntitle.dat " " $( BASESET_DIR) / "
$( Q) cp " $( BIN_DIR) /baseset/ " *.obm " $( BASESET_DIR) / "
2008-08-15 11:58:15 +00:00
$( Q) cp " $( BIN_DIR) /lang/ " *.lng " $( LANG_DIR) / "
$( Q) cp " $( ROOT_DIR) /readme.txt " " $( BUNDLE_DIR) / "
$( Q) cp " $( ROOT_DIR) /COPYING " " $( BUNDLE_DIR) / "
2008-08-21 09:51:03 +00:00
$( Q) cp " $( ROOT_DIR) /known-bugs.txt " " $( BUNDLE_DIR) / "
2008-08-15 11:58:15 +00:00
$( Q) cp " $( ROOT_DIR) /docs/multiplayer.txt " " $( BUNDLE_DIR) /docs/ "
2008-08-21 09:51:03 +00:00
$( Q) cp " $( ROOT_DIR) /changelog.txt " " $( BUNDLE_DIR) / "
2008-08-15 11:58:15 +00:00
i f d e f M A N _ D I R
$( Q) mkdir -p " $( BUNDLE_DIR) /man/ "
$( Q) cp " $( ROOT_DIR) /docs/openttd.6 " " $( BUNDLE_DIR) /man/ "
2008-12-20 11:03:07 +00:00
$( Q) gzip -9 " $( BUNDLE_DIR) /man/openttd.6 "
2008-08-15 11:58:15 +00:00
e n d i f
$( Q) cp " $( ROOT_DIR) /media/openttd.32.xpm " " $( BUNDLE_DIR) /media/ "
$( Q) cp " $( ROOT_DIR) /media/openttd. " *.png " $( BUNDLE_DIR) /media/ "
2008-11-16 13:05:39 +00:00
$( Q) cp " $( BIN_DIR) /scripts/ " * " $( BUNDLE_DIR) /scripts/ "
2015-08-16 21:01:40 +00:00
$( Q) cp " $( BIN_DIR) /data/ " *.grf " $( BUNDLE_DIR) /data/ "
2008-08-15 11:58:15 +00:00
i f d e f M E N U _ D I R
$( Q) cp " $( ROOT_DIR) /media/openttd.desktop " " $( BUNDLE_DIR) /media/ "
2016-05-11 18:39:18 +00:00
$( Q) $( AWK) -f " $( ROOT_DIR) /media/openttd.desktop.translation.awk " " $( SRC_DIR) /lang/ " *.txt | LC_ALL = C $( SORT) | $( AWK) -f " $( ROOT_DIR) /media/openttd.desktop.filter.awk " >> " $( BUNDLE_DIR) /media/openttd.desktop "
2010-05-22 19:59:37 +00:00
$( Q) sed s/= openttd/= $( BINARY_NAME) /g " $( BUNDLE_DIR) /media/openttd.desktop " > " $( ROOT_DIR) /media/openttd.desktop.install "
2008-08-15 11:58:15 +00:00
e n d i f
i f e q ( $( TTD ) , o p e n t t d . e x e )
2008-08-20 21:36:46 +00:00
$( Q) unix2dos " $( BUNDLE_DIR) /docs/ " * " $( BUNDLE_DIR) /readme.txt " " $( BUNDLE_DIR) /COPYING " " $( BUNDLE_DIR) /changelog.txt " " $( BUNDLE_DIR) /known-bugs.txt "
2008-11-26 13:12:45 +00:00
i f e q ( $( OS ) , D O S )
2013-09-19 07:42:13 +00:00
$( Q) cp " $( ROOT_DIR) /os/dos/cwsdpmi/cwsdpmi.txt " " $( BUNDLE_DIR) /docs/ "
2008-11-26 13:12:45 +00:00
i f n d e f S T R I P
2013-09-19 07:42:13 +00:00
$( Q) cp " $( ROOT_DIR) /os/dos/cwsdpmi/cwsdpmi.exe " " $( TTD_DIR) / "
2008-11-26 13:12:45 +00:00
e n d i f
e n d i f
2008-08-15 11:58:15 +00:00
e n d i f
### 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:=<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 " .
2009-08-15 11:12:19 +00:00
bundle_7z : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).7z'
$( Q) mkdir -p " $( BUNDLES_DIR) "
$( Q) cd " $( BUNDLE_DIR) " && 7z a " $( BUNDLES_DIR) / $( BUNDLE_NAME) .7z " .
2008-08-15 11:58:15 +00:00
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 "
2009-08-15 10:57:00 +00:00
bundle_lzma : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.lzma'
$( Q) mkdir -p " $( BUNDLES_DIR) /.lzma/ $( BUNDLE_NAME) "
$( Q) cp -R " $( BUNDLE_DIR) / " * " $( BUNDLES_DIR) /.lzma/ $( BUNDLE_NAME) / "
$( Q) cd " $( BUNDLES_DIR) /.lzma " && tar --lzma -c$( shell if test -n " $( VERBOSE) " ; then echo 'v' ; fi ) f " $( BUNDLES_DIR) / $( BUNDLE_NAME) .tar.lzma " " $( BUNDLE_NAME) "
$( Q) rm -rf " $( BUNDLES_DIR) /.lzma "
2010-10-26 22:03:37 +00:00
bundle_xz : bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.xz'
$( Q) mkdir -p " $( BUNDLES_DIR) /.xz/ $( BUNDLE_NAME) "
$( Q) cp -R " $( BUNDLE_DIR) / " * " $( BUNDLES_DIR) /.xz/ $( BUNDLE_NAME) / "
$( Q) cd " $( BUNDLES_DIR) /.xz " && tar --xz -c$( shell if test -n " $( VERBOSE) " ; then echo 'v' ; fi ) f " $( BUNDLES_DIR) / $( BUNDLE_NAME) .tar.xz " " $( BUNDLE_NAME) "
$( Q) rm -rf " $( BUNDLES_DIR) /.xz "
2008-08-15 11:58:15 +00:00
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) "
2008-08-20 21:36:46 +00:00
bundle_exe : all
@echo '[BUNDLE] Creating $(BUNDLE_NAME).exe'
2008-08-21 09:51:03 +00:00
$( Q) mkdir -p " $( BUNDLES_DIR) "
2010-08-21 21:07:34 +00:00
$( Q) unix2dos " $( ROOT_DIR) /docs/ " *.txt " $( ROOT_DIR) /readme.txt " " $( ROOT_DIR) /COPYING " " $( ROOT_DIR) /changelog.txt " " $( ROOT_DIR) /known-bugs.txt "
2009-09-01 10:07:22 +00:00
$( Q) cd $( ROOT_DIR) /os/windows/installer && makensis.exe //DVERSION_INCLUDE= version_$( PLATFORM) .txt install.nsi
$( Q) mv $( ROOT_DIR) /os/windows/installer/*$( PLATFORM) .exe " $( BUNDLES_DIR) / $( BUNDLE_NAME) .exe "
2008-08-20 21:36:46 +00:00
2008-08-15 11:58:15 +00:00
i f d e f O S X A P P
install :
@echo '[INSTALL] Cannot install the OSX Application Bundle'
e l s e
install : bundle
@echo '[INSTALL] Installing OpenTTD'
$( Q) install -d " $( INSTALL_BINARY_DIR) "
$( Q) install -d " $( INSTALL_ICON_DIR) "
2009-08-22 16:07:39 +00:00
$( Q) install -d " $( INSTALL_DATA_DIR) /ai "
2015-09-17 13:12:21 +00:00
$( Q) install -d " $( INSTALL_DATA_DIR) /game "
2011-11-14 21:38:36 +00:00
$( Q) install -d " $( INSTALL_DATA_DIR) /baseset "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_DATA_DIR) /lang "
2008-11-16 21:37:41 +00:00
$( Q) install -d " $( INSTALL_DATA_DIR) /scripts "
2008-10-16 11:12:18 +00:00
i f e q ( $( TTD ) , o p e n t t d . e x e )
$( Q) install -m 755 " $( BUNDLE_DIR) / $( TTD) " " $( INSTALL_BINARY_DIR) / ${ BINARY_NAME } .exe "
e l s e
$( Q) install -m 755 " $( BUNDLE_DIR) / $( TTD) " " $( INSTALL_BINARY_DIR) / ${ BINARY_NAME } "
e n d i f
2008-08-15 11:58:15 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /lang/ " * " $( INSTALL_DATA_DIR) /lang "
2009-08-22 16:07:39 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /ai/ " * " $( INSTALL_DATA_DIR) /ai "
2015-09-17 13:12:21 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /game/ " * " $( INSTALL_DATA_DIR) /game "
2011-11-14 21:38:36 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /baseset/ " * " $( INSTALL_DATA_DIR) /baseset "
2015-09-07 16:39:29 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /data/ " * " $( INSTALL_DATA_DIR) /data "
2008-11-16 13:05:39 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /scripts/ " * " $( INSTALL_DATA_DIR) /scripts "
2010-10-20 07:23:40 +00:00
i f n d e f D O _ N O T _ I N S T A L L _ D O C S
$( Q) install -d " $( INSTALL_DOC_DIR) "
$( Q) install -m 644 " $( BUNDLE_DIR) /docs/ " * " $( BUNDLE_DIR) /readme.txt " " $( BUNDLE_DIR) /known-bugs.txt " " $( INSTALL_DOC_DIR) "
e n d i f
i f n d e f D O _ N O T _ I N S T A L L _ C H A N G E L O G
$( Q) install -d " $( INSTALL_DOC_DIR) "
$( Q) install -m 644 " $( BUNDLE_DIR) /changelog.txt " " $( INSTALL_DOC_DIR) "
e n d i f
i f n d e f D O _ N O T _ I N S T A L L _ L I C E N S E
$( Q) install -d " $( INSTALL_DOC_DIR) "
2008-10-16 11:04:07 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /COPYING " " $( INSTALL_DOC_DIR) "
2010-10-20 07:23:40 +00:00
e n d i f
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.32.xpm " " $( INSTALL_ICON_DIR) / ${ BINARY_NAME } .32.xpm "
2008-08-15 11:58:15 +00:00
i f d e f I C O N _ T H E M E _ D I R
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) "
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /16x16/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.16.png " " $( INSTALL_ICON_THEME_DIR) /16x16/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /32x32/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.32.png " " $( INSTALL_ICON_THEME_DIR) /32x32/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /48x48/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.48.png " " $( INSTALL_ICON_THEME_DIR) /48x48/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /64x64/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.64.png " " $( INSTALL_ICON_THEME_DIR) /64x64/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /128x128/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.128.png " " $( INSTALL_ICON_THEME_DIR) /128x128/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_ICON_THEME_DIR) /256x256/apps "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /media/openttd.256.png " " $( INSTALL_ICON_THEME_DIR) /256x256/apps/ ${ BINARY_NAME } .png "
2008-08-15 11:58:15 +00:00
e l s e
$( Q) install -m 644 " $( BUNDLE_DIR) /media/ " *.png " $( INSTALL_ICON_DIR) "
e n d i f
i f d e f M A N _ D I R
2010-10-20 07:23:40 +00:00
i f n d e f D O _ N O T _ I N S T A L L _ M A N
2008-08-15 11:58:15 +00:00
$( Q) install -d " $( INSTALL_MAN_DIR) "
2008-10-16 11:12:18 +00:00
$( Q) install -m 644 " $( BUNDLE_DIR) /man/openttd.6.gz " " $( INSTALL_MAN_DIR) / ${ BINARY_NAME } .6.gz "
2008-08-15 11:58:15 +00:00
e n d i f
2010-10-20 07:23:40 +00:00
e n d i f
2008-08-15 11:58:15 +00:00
i f d e f M E N U _ D I R
$( Q) install -d " $( INSTALL_MENU_DIR) "
2008-10-16 13:02:15 +00:00
$( Q) install -m 644 " $( ROOT_DIR) /media/openttd.desktop.install " " $( INSTALL_MENU_DIR) / ${ BINARY_NAME } .desktop "
2008-08-15 11:58:15 +00:00
e n d i f
e n d i f # OSXAPP