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
 
@@ -11,18 +11,20 @@ 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!!
 
@@ -104,12 +106,13 @@ 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 \
 
@@ -200,12 +203,15 @@ endif
 
	$(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
 
@@ -266,9 +272,15 @@ install: bundle
 
	$(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
 
@@ -26,15 +26,17 @@ set_default() {
 
	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"
 
@@ -45,12 +47,13 @@ set_default() {
 
	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"
 
@@ -83,15 +86,17 @@ set_default() {
 
		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
 
@@ -102,12 +107,13 @@ set_default() {
 
		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
 
@@ -188,12 +194,15 @@ detect_params() {
 
			--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";;
 
@@ -201,12 +210,20 @@ detect_params() {
 

	
 
			--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";;
 
@@ -734,13 +751,13 @@ check_params() {
 
		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"
 
@@ -846,12 +863,19 @@ check_params() {
 
	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
 
@@ -2224,12 +2248,31 @@ make_sed() {
 
		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
 
@@ -2240,12 +2283,16 @@ generate_main() {
 
	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
 
@@ -2338,12 +2385,15 @@ showhelp() {
 
	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 [/]"
 
@@ -2366,12 +2416,15 @@ showhelp() {
 
	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)"
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)