summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 110c4c863872f910911113efae43f8a52442999a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/make -f
#  $Id$
#
#  debian/rules file for phpbb3 Debian package
#
#  Written from scratch, with inspiration from apache's debian/rules, and the
#  examples from dh_make
#  Copyright 2002, 2004 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
#
#  Complete overhaul for debhelper 7 and dpkg source format 3 (quilt)
#  Copyright 2010 J.M. Roth <jmroth@iip.lu>
#
#  Distributed under the GNU General Public License version 2

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Bash is easier
export SHELL = /bin/bash

VERSION := $(shell dpkg-parsechangelog --show-field Version)
UPSTREAM   := $(shell dpkg-parsechangelog --show-field Version | grep --only-matching '^[[:digit:].]\+')
# Last version that matches the database
LAST_VERSION := 3.0.12

get-orig-source:
	debian/get-orig-source ${UPSTREAM} _all
	@# mv *.orig*.tar* ..

override_dh_auto_clean:
	debconf-updatepo -v

override_dh_installchangelogs:
	dh_installchangelogs docs/CHANGELOG.html -pphpbb3
	dh_installchangelogs -pphpbb3-l10n

override_dh_installdeb:
	@# customize the stuff in the build directory
	rm debian/phpbb3/usr/share/phpbb3/install/schemas/index.htm
	cd debian/phpbb3/usr/share/phpbb3/docs && rm AUTHORS COPYING INSTALL.html
	sed -i "s/@VERSION@/$(VERSION) (Debian)/" debian/phpbb3/usr/share/phpbb3/www/common.php

	install -m 0755 debian/database_update_debian.php debian/phpbb3/usr/share/phpbb3/install/database_update_debian.php

	@# prune the language packs
	find debian/phpbb3-l10n/usr/share/phpbb3/www/language \( -name docs -o -name mods \) -type d -print0 | xargs -0r rm -r
	find debian/phpbb3-l10n/usr/share/phpbb3/www/language \( -name AUTHORS -o -name COPYING -o -name LICENSE -o -name README -o -name VERSION \) -type f -print0 | xargs -0r rm

	@### dbconfig install

	@# mysql
	cp install/schemas/mysql_41_schema.sql debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/mysql
	cat debian/schema_data_debian.sql >> debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/mysql

	@# postgres
	cp install/schemas/postgres_schema.sql debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/pgsql
	cat debian/schema_data_debian.sql | sed "s/# POSTGRES BEGIN #/BEGIN;/" | sed "s/^#.*//" | sed -e 's/`/"/g' -e 's/UNIX_TIMESTAMP()/EXTRACT(EPOCH FROM CURRENT_TIMESTAMP(0))/' >> debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/pgsql
	debian/postgres_update_seqs.sh install/schemas/postgres_schema.sql >> debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/pgsql
	echo "COMMIT;" >> debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/pgsql

	@# sqlite
	grep -v ^# install/schemas/sqlite_schema.sql > debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/sqlite
	debian/sqliteconv1.sh debian/schema_data_debian.sql | perl -p debian/sqliteconv2.pl \
	  >> debian/phpbb3/usr/share/phpbb3/dbconfig-common/data/phpbb3/install/sqlite

	@### dbconfig update
	@###(some update /data/ copied via dh_install already)

	@# mysql
	install -m 0755 debian/database_update_debian.php debian/phpbb3/usr/share/dbconfig-common/scripts/phpbb3/upgrade/mysql/$(LAST_VERSION)

	@# postgres
	@#scripts
	install -m 0755 debian/database_update_debian.php debian/phpbb3/usr/share/dbconfig-common/scripts/phpbb3/upgrade/pgsql/$(LAST_VERSION)

	dh_installdeb

%:
	dh $@