-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkdebian.pl
124 lines (96 loc) · 3.26 KB
/
mkdebian.pl
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/perl -w
use strict;
use warnings;
my $num = `git log --pretty=oneline | wc -l`;
chomp($num);
my $branch = `git branch | grep \\\* | cut -c 3-`;
chomp($branch);
my $date = `date -R`;
my $basename = "cyrus-$branch";
my $basedir = $branch eq 'fastmail' ? 'usr/cyrus' : "usr/$basename";
mkdir("debian");
open(FH, ">debian/changelog");
print FH <<EOF;
cyrus-$branch ($num-1) experimental; urgency=low
* basic package set up
-- Bron Gondwana <brong\@fastmail.fm> $date
EOF
close(FH);
open(FH, ">debian/control");
print FH <<EOF;
Source: $basename
Section: mail
Priority: extra
Maintainer: Bron Gondwana <brong\@fastmail.fm>
Build-Depends: libssl-dev, zlib1g-dev, comerr-dev, libsasl2-dev,
libzephyr-dev, libpcre3-dev, autoconf, libxapian-dev,
libxml2-dev, libical-dev, libsqlite3-dev,
flex, bison, debhelper, libsnmp-dev, libglib2.0-dev
Package: $basename
Architecture: all
Depends: \${shlibs:Depends}
Description: Cyrus package for branch $branch at FastMail.FM
Package: $basename-build
Architecture: all
Depends: \${shlibs:Depends}
Description: Cyrus package for branch $branch at FastMail.FM - build files
EOF
close(FH);
open(FH, ">debian/copyright");
print FH "See the upstream files at CMU\n";
close(FH);
open(FH, ">debian/rules");
print FH <<EOF;
#!/usr/bin/make -f
# debian/rules for alien
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# Use v4 compatability mode, so ldconfig gets added to maint scripts.
export DH_COMPAT=4
PACKAGE=\$(shell dh_listpackages)
build:
dh_testdir
autoreconf -v -i
./configure --without-krb --with-perl=/usr/bin/perl --enable-http --enable-calalarmd --enable-idled --with-extraident=git-$branch-$num --prefix=/$basedir -with-cyrus-prefix=/$basedir --with-zlib --without-snmp --enable-replication --without-bdb --enable-xapian --enable-apple-push-service
make -j 8 all CFLAGS="-g -fPIC -W -Wall -Werror -fstack-protector-all"
make sieve/test
touch build
clean:
dh_testdir
dh_testroot
dh_clean -d
rm -f build
binary-indep: build
binary-arch: build
dh_testdir
dh_testroot
dh_clean -k -d
dh_installdirs
dh_installdocs
dh_installchangelogs
make install DESTDIR=\$(CURDIR)/debian/$basename
make install-binsymlinks DESTDIR=\$(CURDIR)/debian/$basename
/bin/bash ./libtool --mode=install install -o root -m 755 sieve/test \$(PWD)/debian/$basename/$basedir/bin/sieve-test
install -o root -m 755 tools/rehash debian/$basename/$basedir/bin/rehash
install -o root -m 755 tools/mkimap debian/$basename/$basedir/bin/mkimap
install -o root -m 755 tools/translatesieve debian/$basename/$basedir/bin/translatesieve
install -o root -m 755 tools/upgradesieve debian/$basename/$basedir/bin/upgradesieve
# set up source package
# no need to actually install the built object files! It's just the source we want
mkdir -p debian/$basename-build/usr/src/$basename-build/cyrus
# but keep the git data so we can build again!
find . -maxdepth 1 -mindepth 1 -not -name debian -print0 | \\
xargs -0 -r -i cp -a {} debian/$basename-build/usr/src/$basename-build/cyrus/
dh_compress
dh_makeshlibs
dh_installdeb
#-dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb -- -z3
binary: binary-arch
EOF
close(FH);
chmod(0755, "debian/rules");
print "Debian build environment for branch \"$branch\" set up
- run dpkg-buildpackage to build\n";