(svn r14237) -Feature [Debian]: Allow the Debian packaging to change the package name of the resulting package.
authormatthijs
Wed, 03 Sep 2008 16:47:54 +0000
changeset 10069 891d75deeb73
parent 10068 a32f54c91520
child 10070 8970f1074f21
(svn r14237) -Feature [Debian]: Allow the Debian packaging to change the package name of the resulting package.
- The name can be changed at build time, by changing the package name in debian/changelog.
- This will allow packages like openttd-svn or openttd-cargodest packages to be built.
os/debian/control
os/debian/control.in
os/debian/rules
--- a/os/debian/control	Wed Sep 03 13:25:56 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-Source: openttd
-Section: contrib/games
-Priority: optional
-Maintainer: Matthijs Kooijman <m.kooijman@student.utwente.nl>
-Uploaders: Jordi Mallach <jordi@debian.org>
-Build-Depends: debhelper (>= 4.0.0), dpatch, libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev
-Standards-Version: 3.7.2
-
-Package: openttd
-Architecture: any
-Depends: ${shlibs:Depends}, debconf
-Suggests: timidity, freepats
-Description: reimplementation of Transport Tycoon Deluxe with enhancements
- A reimplementation of the Microprose game "Transport Tycoon Deluxe" with lots
- of new features and enhancements.
- You require the data files of the original Transport Tycoon Deluxe
- for Windows to play the game. You have to MANUALLY copy them to the
- game data directory! (see README.Debian for details)
- .
- Homepage: http://www.openttd.org/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/os/debian/control.in	Wed Sep 03 16:47:54 2008 +0000
@@ -0,0 +1,20 @@
+Source: PACKAGE
+Section: contrib/games
+Priority: optional
+Maintainer: Matthijs Kooijman <m.kooijman@student.utwente.nl>
+Uploaders: Jordi Mallach <jordi@debian.org>
+Build-Depends: debhelper (>= 4.0.0), dpatch, libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev
+Standards-Version: 3.7.2
+
+Package: PACKAGE
+Architecture: any
+Depends: ${shlibs:Depends}, debconf
+Suggests: timidity, freepats
+Description: reimplementation of Transport Tycoon Deluxe with enhancements
+ A reimplementation of the Microprose game "Transport Tycoon Deluxe" with lots
+ of new features and enhancements.
+ You require the data files of the original Transport Tycoon Deluxe
+ for Windows to play the game. You have to MANUALLY copy them to the
+ game data directory! (see README.Debian for details)
+ .
+ Homepage: http://www.openttd.org/
--- a/os/debian/rules	Wed Sep 03 13:25:56 2008 +0000
+++ b/os/debian/rules	Wed Sep 03 16:47:54 2008 +0000
@@ -6,9 +6,24 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+DEFAULT_PACKAGE := openttd
+# Find the package name from the topmost changelog entry.
+# Is this the best way to do this?
+PACKAGE = $(shell cat debian/changelog | head -1 | cut -f1 -d' ')
+
 include /usr/share/dpatch/dpatch.make
 
-configure: patch configure-stamp
+debian/control:
+	# Generate control file
+	sed 's/PACKAGE/$(PACKAGE)/' debian/control.in > debian/control
+
+	# TODO: How to do this using makefile conditionals?
+	if [ "$(PACKAGE)" != "$(DEFAULT_PACKAGE)" ]; then \
+		echo "Provides: $(DEFAULT_PACKAGE)" >> debian/control ; \
+		echo "Conflicts: $(DEFAULT_PACKAGE)" >> debian/control ; \
+	fi;
+
+configure: debian/control patch configure-stamp
 configure-stamp:
 	dh_testdir
 	# Add here commands to configure the package.
@@ -16,20 +31,20 @@
 	touch configure-stamp
 
 
-build: configure build-stamp
+build: debian/control configure build-stamp
 build-stamp:
 	dh_testdir
 
 	# Add here commands to compile the package.
 	
-	./configure --prefix-dir=/usr --binary-dir=games --data-dir=share/games/openttd --icon-dir=share/pixmaps --personal-dir=.openttd --install-dir=debian/openttd
+	./configure --prefix-dir=/usr --binary-dir=games --data-dir=share/games/openttd --icon-dir=share/pixmaps --personal-dir=.openttd --install-dir=debian/$(PACKAGE)
 	$(MAKE)
 
 	#/usr/bin/docbook-to-man debian/openttd.sgml > openttd.1
 
 	touch build-stamp
 
-clean: unpatch
+clean: debian/control unpatch
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp configure-stamp
@@ -38,8 +53,10 @@
 	-$(MAKE) clean
 
 	dh_clean
+	# Clean up generated control file
+	-rm debian/control
 
-install: build
+install: debian/control build
 	dh_testdir
 	dh_testroot
 	dh_clean -k
@@ -53,7 +70,7 @@
 # We have nothing to do by default.
 
 # Build architecture-dependent files here.
-binary-arch: build install
+binary-arch: debian/control build install
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs changelog.txt