Changeset - r9680:2c69c1ec1eeb
[Not reviewed]
master
0 2 1
skidd13 - 16 years ago 2008-07-22 17:18:53
skidd13@openttd.org
(svn r13785) -Add: support for freedesktop.org desktop entry files
3 files changed with 80 insertions and 2 deletions:
0 comments (0 inline, 0 general)
Makefile.in
Show inline comments
 
@@ -5,30 +5,32 @@ ifdef VERBOSE
 
	Q =
 
else
 
	Q = @
 
endif
 

	
 
include Makefile.am
 

	
 
SOURCE_LIST = !!SOURCE_LIST!!
 
CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!!
 
CONFIGURE_FILES = !!CONFIGURE_FILES!!
 
LIPO = !!LIPO!!
 
BIN_DIR = !!BIN_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_MENU_DIR = "$(INSTALL_DIR)/$(MENU_DIR)"
 
INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
 
INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
 
TTD = !!TTD!!
 
TTDS = $(SRC_DIRS:%=%/$(TTD))
 
OS = !!OS!!
 
OSXAPP = !!OSXAPP!!
 
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 )
 

	
 
@@ -98,24 +100,25 @@ clean:
 
lang:
 
	@for dir in $(LANG_DIRS); do \
 
		$(MAKE) -C $$dir all; \
 
	done
 

	
 
mrproper:
 
	@for dir in $(DIRS); do \
 
		$(MAKE) -C $$dir mrproper; \
 
		rm -f $$dir/Makefile; \
 
	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)
 

	
 
depend:
 
	@for dir in $(SRC_DIRS); do \
 
		$(MAKE) -C $$dir depend; \
 
	done
 

	
 
run: all
 
	$(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS)
 

	
 
@@ -194,24 +197,27 @@ endif
 
	$(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/"
 
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"
 
endif
 

	
 
### Packing the current bundle into several compressed file formats ###
 
#
 
@@ -260,15 +266,21 @@ 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)install -m 644 "$(BUNDLE_DIR)/media/openttd.64.png" "$(INSTALL_ICON_DIR)"
 
	$(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.xpm" "$(INSTALL_ICON_DIR)"
 
	$(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.bmp" "$(INSTALL_ICON_DIR)"
 
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
config.lib
Show inline comments
 
@@ -20,43 +20,46 @@ set_default() {
 
	strip=""
 
	lipo=""
 
	awk="awk"
 
	os="DETECT"
 
	endian="AUTO"
 
	cpu_type="DETECT"
 
	revision=""
 
	config_log="config.log"
 
	prefix_dir="/usr/local"
 
	binary_dir="games"
 
	data_dir="share/games/openttd"
 
	icon_dir="share/pixmaps"
 
	menu_dir="share/applications"
 
	personal_dir="1"
 
	shared_dir="1"
 
	install_dir="/"
 
	menu_group="Game;"
 
	enable_debug="0"
 
	enable_desync_debug="0"
 
	enable_profiling="0"
 
	enable_dedicated="0"
 
	enable_network="1"
 
	enable_static="1"
 
	enable_translator="0"
 
	enable_unicode="1"
 
	enable_assert="1"
 
	enable_strip="0"
 
	enable_universal="1"
 
	enable_osx_g5="0"
 
	enable_cocoa_quartz="1"
 
	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"
 
	with_png="1"
 
	with_makedepend="1"
 
	with_direct_music="1"
 
	with_sort="1"
 
	with_iconv="1"
 
	with_midi=""
 
	with_midi_arg=""
 
	with_libtimidity="1"
 
	with_freetype="1"
 
@@ -77,43 +80,46 @@ set_default() {
 
		strip
 
		lipo
 
		awk
 
		os
 
		endian
 
		cpu_type
 
		revision
 
		config_log
 
		prefix_dir
 
		binary_dir
 
		data_dir
 
		icon_dir
 
		menu_dir
 
		personal_dir
 
		shared_dir
 
		install_dir
 
		menu_group
 
		enable_debug
 
		enable_desync_debug
 
		enable_profiling
 
		enable_dedicated
 
		enable_network
 
		enable_static
 
		enable_translator
 
		enable_unicode
 
		enable_assert
 
		enable_strip
 
		enable_universal
 
		enable_osx_g5
 
		enable_cocoa_quartz
 
		enable_cocoa_quickdraw
 
		with_osx_sysroot
 
		with_application_bundle
 
		with_menu_entry
 
		with_sdl
 
		with_cocoa
 
		with_zlib
 
		with_png
 
		with_makedepend
 
		with_direct_music
 
		with_sort
 
		with_iconv
 
		with_midi
 
		with_midi_arg
 
		with_libtimidity
 
		with_freetype
 
@@ -182,37 +188,48 @@ detect_params() {
 
			--prefix-dir)                 prevp_p="prefix-dir";;
 
			--prefix-dir=*)               prefix_dir="$optarg";;
 

	
 
			--binary-dir)                 prevp_p="binary-dir";;
 
			--binary-dir=*)               binary_dir="$optarg";;
 

	
 
			--data-dir)                   prevp_p="data-dir";;
 
			--data-dir=*)                 data_dir="$optarg";;
 

	
 
			--icon-dir)                   prevp_p="icon-dir";;
 
			--icon-dir=*)                 icon_dir="$optarg";;
 

	
 
			--menu-dir)                   prevp_p="menu_dir";;
 
			--menu-dir=*)                 menu_dir="$optarg";;
 

	
 
			--personal-dir)               prevp_p="personal-dir";;
 
			--personal-dir=*)             personal_dir="$optarg";;
 
			--without-personal-dir)       personal_dir="";;
 

	
 
			--shared-dir)                 prevp_p="shared-dir";;
 
			--shared-dir=*)               shared_dir="$optarg";;
 
			--without-shared-dir)         shared_dir="";;
 

	
 
			--install-dir)                prevp_p="install-dir";;
 
			--install-dir=*)              install_dir="$optarg";;
 

	
 

	
 

	
 
			--with-menu-entry)            with_menu_entry="1";;
 
			--without-menu-entry)         with_menu_entry="0";;
 

	
 
			--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";;
 
			--enable-desync-debug=*)      enable_desync_debug="$optarg";;
 
			--enable-profiling)           enable_profiling="1";;
 
			--enable-profiling=*)         enable_profiling="$optarg";;
 
			--enable-dedicated)           enable_dedicated="1";;
 
			--enable-dedicated=*)         enable_dedicated="$optarg";;
 
			--enable-network=*)           enable_network="$optarg";;
 
			--disable-network)            enable_network="0";;
 
			--disable-static)             enable_static="0";;
 
			--enable-static)              enable_static="2";;
 
@@ -728,25 +745,25 @@ check_params() {
 
		OSXAPP=""
 
	fi
 

	
 
	if [ "$os" = "OSX" ]; then
 
		# Test on G5
 

	
 
		if [ "$enable_osx_g5" != "0" ]; then
 
			log 1 "detecting G5... yes (forced)"
 
		else
 
			# 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
 
				if [ -n "$res" ]; then
 
					# This is G5, add flags for it
 
					enable_osx_g5="2"
 

	
 
					log 1 "detecting G5... yes"
 
				else
 
					enable_osx_g5="0"
 

	
 
					log 1 "detecting G5... no"
 
@@ -840,24 +857,31 @@ check_params() {
 
	then
 
		log 1 "shared data directory... $shared_dir"
 
	else
 
		log 1 "shared data directory... none"
 
	fi
 

	
 
	if [ -n "$install_dir" ]
 
	then
 
		log 1 "installation directory... $install_dir"
 
	else
 
		log 1 "installation directory... none"
 
	fi
 

	
 
	if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ] || [ "$os" = "OS2" ] || [ "$os" = "WINCE" ] || [ "$os" = "PSP" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ]; then
 
		# Don't create a .desktop file
 
		with_menu_entry="0"
 
		menu_dir=""
 
		menu_group=""
 
	fi
 
}
 

	
 
make_cflags_and_ldflags() {
 
	# General CFlags for BUILD
 
	CFLAGS_BUILD=""
 
	# General CFlags for HOST
 
	CFLAGS="$CFLAGS -D$os"
 
	# CFlags for HOST and C-Compiler
 
	CC_FLAGS=""
 
	# Libs to compile. In fact this is just LDFLAGS
 
	LIBS="-lstdc++"
 
	# LDFLAGS used for HOST
 
@@ -2218,40 +2242,63 @@ make_sed() {
 
		s#!!OBJS_C!!#$OBJS_C#g;
 
		s#!!OBJS_CPP!!#$OBJS_CPP#g;
 
		s#!!OBJS_MM!!#$OBJS_MM#g;
 
		s#!!OBJS_RC!!#$OBJS_RC#g;
 
		s#!!SRCS!!#$SRCS#g;
 
		s#!!OS!!#$os#g;
 
		s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g;
 
		s#!!REVISION!!#$revision#g;
 
		s#!!AWK!!#$awk#g;
 
		s#!!GCC295!!#$gcc295#g;
 
		s#!!DISTCC!!#$distcc#g;
 
	"
 

	
 
	if [ "$with_menu_entry" = "1" ]; 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() {
 
	STAGE="[MAIN]"
 

	
 
	make_sed
 

	
 
	# Create the main Makefile
 
	echo "Generating Makefile..."
 
	< $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" > Makefile
 
	echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
 
	echo >> Makefile.am
 
	# Make the copy of the source-list, so we don't trigger an unwanted recompile
 
	cp $SOURCE_LIST config.cache.source.list
 
	# Make sure config.cache is OLDER then config.cache.source.list
 
	touch config.cache
 

	
 
	if [ "$with_menu_entry" = "1" ]; then
 
		generate_menu_item
 
	fi
 
}
 

	
 
generate_lang() {
 
	STAGE="[LANG]"
 

	
 
	make_sed
 

	
 
	# Create the language file
 
	mkdir -p $LANG_OBJS_DIR
 

	
 
	echo "Generating lang/Makefile..."
 
	< $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" > $LANG_OBJS_DIR/Makefile
 
@@ -2332,24 +2379,27 @@ showhelp() {
 
	echo "                                 Use with care!"
 
	echo ""
 
	echo "Paths:"
 
	echo "  --prefix-dir=dir               specifies the prefix for all installed"
 
	echo "                                 files [/usr/local]"
 
	echo "  --binary-dir=dir               location of the binary. Will be prefixed"
 
	echo "                                 with the prefix-dir [games]"
 
	echo "  --data-dir=dir                 location of data files (lang, data, gm)."
 
	echo "                                 Will be prefixed with the prefix-dir"
 
	echo "                                 [share/games/openttd]"
 
	echo "  --icon-dir=dir                 location of icons. Will be prefixed"
 
	echo "                                 with the prefix-dir [share/pixmaps]"
 
	echo "  --menu-dir=dir                 location of the menu item. (UNIX only, except OSX)"
 
	echo "                                 Will be prefixed with the prefix-dir"
 
	echo "                                 [share/applications]"
 
	echo "  --personal-dir=dir             location of the personal directory"
 
	echo "                                 [os-dependent default]"
 
	echo "  --shared-dir=dir               location of shared data files"
 
	echo "                                 [os-dependent default]"
 
	echo "  --install-dir=dir              specifies the root to install to."
 
	echo "                                 Useful to install into jails [/]"
 
	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-profiling             enables profiling"
 
	echo "  --enable-dedicated             compile a dedicated server (without video)"
 
@@ -2360,24 +2410,27 @@ showhelp() {
 
	echo "  --enable-osx-g5                enables optimalizations 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"
 
	echo "                                 version (Win32 ONLY)"
 
	echo "  --disable-network              disable network support"
 
	echo "  --disable-assert               disable asserts (continue on errors)"
 
	echo "  --enable-strip                 enable any possible stripping"
 
	echo "  --without-osx-sysroot          disable the automatic adding of sysroot "
 
	echo "                                 (OSX ONLY)"
 
	echo "  --without-application-bundle   disable generation of application bundle"
 
	echo "                                 (OSX ONLY)"
 
	echo "  --with-menu-entry              Generate a menu item on for UNIX desktops (Except OSX)"
 
	echo "  --without-menu-entry           Don't generate a menu item"
 
	echo "  --menu_group=group             Category in which the menu item will be placed (UNIX only, except OSX)"
 
	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"
 
	echo "  --with-midi-arg=arg            define which args to use for the"
 
	echo "                                 midi-player"
 
	echo "  --with-cocoa                   enables COCOA video driver (OSX ONLY)"
 
	echo "  --with-sdl[=sdl-config]        enables SDL video driver support"
 
	echo "  --with-zlib[=zlib.a]           enables zlib support"
 
	echo "  --with-png[=libpng-config]     enables libpng support"
 
	echo "  --with-freetype[=freetype-config]"
 
	echo "                                 enables libfreetype support"
 
	echo "  --with-fontconfig[=pkg-config fontconfig]"
media/openttd.desktop.in
Show inline comments
 
new file 100644
 
# $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!!
0 comments (0 inline, 0 general)