From 26e426cd446067da7ba22eb3307abcf1b98401eb Mon Sep 17 00:00:00 2001
From: Mikko Rantalainen <mikko.rantalainen@peda.net>
Date: Thu, 6 May 2010 11:21:58 +0300
Subject: Improved packaging building

Fixed debian/control and debian/rules to generate architecture
independent binary packages as Etherpad does not include machine code
(as opposed to virtual machine byte code).

Changed the debian source format to "3.0 (native)".
---
 debian/control       |  20 ++++----
 debian/rules         | 129 ++++++++++++++++++++-------------------------------
 debian/source/format |   1 +
 3 files changed, 61 insertions(+), 89 deletions(-)
 create mode 100644 debian/source/format

diff --git a/debian/control b/debian/control
index c6ea8cd..6c99c6f 100644
--- a/debian/control
+++ b/debian/control
@@ -1,19 +1,19 @@
 Source: etherpad
-Section: unknown
+Section: contrib/httpd
 Priority: extra
 Maintainer: Egil Möller <egil.moller@piratpartiet.se>
-Build-Depends: debhelper (>= 7), dbconfig-common, sun-java6-jdk, mysql-client, libmysql-java, scala (>= 2.7), scala-library (>= 2.7)
+Build-Depends: po-debconf, debhelper (>= 7)
+Build-Depends-indep: dbconfig-common, sun-java6-jdk, mysql-client, libmysql-java, scala (>= 2.7), scala-library (>= 2.7)
 Build-Conflicts: libgcj-common, java-gcj-compat-headless, java-gcj-compat, gcj-4.3-base
-Standards-Version: 3.8.0
-Homepage: <insert the upstream URL, if relevant>
+Standards-Version: 3.8.4
+Homepage: http://github.com/mikkorantalainen/pad
 
 Package: etherpad
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, dbconfig-common, sun-java6-jdk, mysql-client, libmysql-java, scala (>= 2.7), mysql-server, m4
-Pre-Depends: dbconfig-common
-Description: Etherpad multiuser web-based word processor
- EtherPad is the only web-based word processor that allows people to work
- together in really real-time.
+Architecture: all
+Depends: ${misc:Depends}, sun-java6-jdk, mysql-client, libmysql-java, scala (>= 2.7), mysql-server, m4
+Pre-Depends: dbconfig-common, debconf, adduser
+Description:  A web-based word processor that allows people to work
+ together in real-time.
  .
  When multiple people edit the same document simultaneously, any changes are
  instantly reflected on everyone's screen. The result is a new and productive
diff --git a/debian/rules b/debian/rules
index dcbce4e..2c692b1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,87 +1,57 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
+# Sample debian/rules that uses debhelper. 
+# This file is public domain software, originally written by Joey Hess.
 #
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
+# This version is for packages that are architecture independent.
+#
+# Rules to build etherpad
 #
-# Modified to make a template file for a multi-binary package with separated
-# build-arch and build-indep targets  by Bill Allombert 2001
-
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-# This has to be exported to make some magic below work.
-export DH_OPTIONS
-
-
-
-
-
-
-configure: configure-stamp
-configure-stamp:
+build: build-stamp
+build-stamp:
 	dh_testdir
-	# Add here commands to configure the package.
-
-	touch configure-stamp
-
-
-#Architecture
-build: build-arch build-indep
-
-build-arch: build-arch-stamp
-build-arch-stamp: configure-stamp  
 
-	# Add here commands to compile the arch part of the package.
+	# Add here commands to compile the package.
 	#$(MAKE)
 	bin/build.sh
-	touch $@
+	touch build-stamp
 
-build-indep: build-indep-stamp
-build-indep-stamp: configure-stamp  
-
-	# Add here commands to compile the indep part of the package.
-	#$(MAKE) doc
-	touch $@
-
-clean: 
+clean:
+	# update template translation strings:
+	debconf-updatepo
 	dh_testdir
 	dh_testroot
-	rm -f build-arch-stamp build-indep-stamp configure-stamp
+	rm -f build-stamp
 
 	# Add here commands to clean up after the build process.
-	#git clean -X
+	#$(MAKE) clean
+	#$(MAKE) distclean
 
-	dh_clean  --exclude ./build/apt/.tmp.local/infrastructure/bin/makejar.sh.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig
+	dh_clean
 
-install: install-indep install-arch
-install-indep:
+install: build
 	dh_testdir
 	dh_testroot
-	dh_prep -i  --exclude ./build/apt/.tmp.local/infrastructure/bin/makejar.sh.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig
-	dh_installdirs -i
+	dh_prep
+	dh_installdirs
+
+	# Add here commands to install the package into debian/<packagename>.
+	#$(MAKE) prefix=`pwd`/debian/`dh_listpackages`/usr install
 
 	# Add here commands to install the indep part of the package into
 	# debian/<package>-doc.
 	#INSTALLDOC#
 
-	dh_install -i
-
-install-arch:
-	dh_testdir
-	dh_testroot
-	dh_prep -s  --exclude ./build/apt/.tmp.local/infrastructure/bin/makejar.sh.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./build/apt/.tmp.local/infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Decompiler.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Parser.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/Token.java.orig --exclude ./infrastructure/yuicompressor/src/yuicompressor/org/mozilla/javascript/TokenStream.java.orig
-	dh_installdirs -s
+	mkdir -p debian/etherpad/usr/share/etherpad
 
-	# Add here commands to install the arch part of the package into
-	# debian/tmp.
-	# $(MAKE) DESTDIR=$(CURDIR)/debian/etherpad install
+	# try to copy content correctly
+	cp -a $$(ls | grep -E -v 'debian|LICENSE|COPYING|INSTALL') debian/etherpad/usr/share/etherpad
+	# fix ups (because the above copy is too dump), remove unneeded stuff
+	find debian/etherpad -type f -and -name ".gitignore" -exec rm {} +
+	find debian/etherpad -type f -and -name "build-stamp" -exec rm {} +
 
-	mkdir -p debian/etherpad/usr/share/etherpad
-	cp -a $$(ls | grep -v debian) debian/etherpad/usr/share/etherpad
 	# create directory to save user data
 	mkdir -p debian/etherpad/usr/share/etherpad/etherpad/data
 
@@ -90,52 +60,53 @@ install-arch:
 	ln -s /etc/etherpad debian/etherpad/usr/share/etherpad/etherpad/etc
 
 	mkdir -p debian/etherpad/var/log/etherpad
+	mkdir -p debian/etherpad/usr/share/lintian/overrides
+	cp debian/source/lintian-overrides debian/etherpad/usr/share/lintian/overrides/etherpad
 
-	mkdir -p debian/etherpad/etc/init.d
-	ln -s /usr/share/etherpad/bin/etherpad.init.d debian/etherpad/etc/init.d/etherpad
+	#mkdir -p debian/etherpad/etc/init.d
+	#ln -s /usr/share/etherpad/bin/etherpad.init.d debian/etherpad/etc/init.d/etherpad
+	dh_installinit --update-rcd-params="start 05 2 3 4 5 . stop 95 S 0 1 6 ."
 
+	dh_install -i
 
-	dh_install -s
 
-# Must not depend on anything. This is to be called by
-# binary-arch/binary-indep
-# in another 'make' thread.
-binary-common:
+# Build architecture-independent files here.
+binary-indep: build install
 	dh_testdir
 	dh_testroot
-	dh_installchangelogs 
+	dh_installchangelogs
 	dh_installdocs
+	# on the fly final copyright file creation:
+	cat debian/copyright LICENSE > debian/etherpad/usr/share/doc/etherpad/copyright
 	dh_installexamples
 #	dh_installmenu
 	dh_installdebconf
 #	dh_installlogrotate
 #	dh_installemacsen
+#	dh_installcatalogs
 #	dh_installpam
 #	dh_installmime
-#	dh_python
 #	dh_installinit
 #	dh_installcron
 #	dh_installinfo
+#	dh_installwm
+#	dh_installudev
+#	dh_lintian
+#	dh_bugfiles
+#	dh_undocumented
 	dh_installman
 	dh_link
-	dh_strip
 	dh_compress
 	dh_fixperms
 #	dh_perl
-	dh_makeshlibs
 	dh_installdeb
-	dh_shlibdeps
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
 
-# Build architecture independant packages using the common target.
-binary-indep: build-indep install-indep
-	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
-
-# Build architecture dependant packages using the common target.
-binary-arch: build-arch install-arch
-	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
+# Build architecture-dependent files here.
+binary-arch: build install
+# We have nothing to do by default.
 
-binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
-- 
cgit v1.2.3