-
Notifications
You must be signed in to change notification settings - Fork 12
/
build
executable file
·100 lines (87 loc) · 3.46 KB
/
build
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
#!/bin/sh
set -e
cd `dirname $0`
genchangelog()
{
echo "$1 ($2) `lsb_release -sc`; urgency=low"
echo
prevtag=$(git describe --abbrev=0 HEAD^)
git log --date=short --format=" * %s (%h, %cd)" "$prevtag"..HEAD |
fold --spaces --width 76 | sed 's/^\([^ ]\+\)/ \1/'
echo
echo " -- $3 `LANG=C date -R`"
}
pkgversion=$(git describe --dirty | cut -c2- |
sed 's/-\([0-9]\+\)-\(g[0-9a-f]\+\)/+\1~\2/' |
sed 's/\(~g[0-9a-f]\+\)-dirty$/-dirty\1/' |
sed 's/-dirty/~dirty.'`date +%Y%m%d%H%M%S`'/'
)-$(lsb_release -cs)
pkgmaint=$(echo "`git config user.name` <`git config user.email`>")
pkgname=libdrizzle-redux
so_filename=libdrizzle-redux.so
version_number=`find ./install/usr/lib/ ! -type l -name "$so_filename.*"`
if [ $(echo $version_number | wc -l) != 1 ]; then
echo "'.so' file not found"
exit 1
fi
libversion=`echo $version_number | grep -o -P -e "([0-9]+\.?)+$"`
lib_major=$(echo $libversion | cut -f1 -d .)
lib_minor=$(echo $libversion | cut -f2 -d .)
lib_patch=$(echo $libversion | cut -f3 -d .)
changelog=`mktemp`
trap "rm -f '$changelog'; exit 1" INT TERM QUIT
so_libname="./install/usr/lib/$so_filename"
genchangelog "$pkgname" "$pkgversion" "$pkgmaint" > "$changelog"
cp $so_libname.$libversion $so_libname.$libversion.full
strip $so_libname.$libversion
fpm -s dir -t deb -n "$pkgname" -v "$pkgversion" \
--architecture all \
--maintainer "$pkgmaint" \
--description "Simplified API to MySQL databases" \
--url 'https://github.com/sociomantic-tsunami/libdrizzle-redux' \
--vendor 'Sociomantic Labs GmbH' \
--license 'Simplified BSD License' \
--category libs \
--depends zlib1g \
--depends libstdc++6 \
--depends libc6 \
--depends libgcc1 \
--deb-changelog "$changelog" \
--deb-no-default-config-files \
--after-install after_install.sh \
$so_libname.$libversion=/usr/lib/ \
$so_libname.$lib_major=/usr/lib/
pkgname=libdrizzle-redux-dbg
genchangelog "$pkgname" "$pkgversion" "$pkgmaint" > "$changelog"
build_id=`readelf -n install/usr/lib/libdrizzle-redux.so.$libversion | \
sed -n 's/^.*Build ID: \([a-f0-9]\{40\}\).*$/\1/p'`
debug_file=`printf $build_id | cut -b1-2`/`printf $build_id | cut -b3-`.debug
objcopy --only-keep-debug $so_libname.$libversion.full $so_libname.$libversion.debug
fpm -s dir -t deb -n "$pkgname" -v "$pkgversion" \
--architecture all \
--maintainer "$pkgmaint" \
--description "Simplified API to MySQL databases" \
--url 'https://github.com/sociomantic-tsunami/libdrizzle-redux' \
--vendor 'Sociomantic Labs GmbH' \
--license 'Simplified BSD License' \
--category debug \
--depends libdrizzle-redux \
--deb-changelog "$changelog" \
--deb-no-default-config-files \
$so_libname.$libversion.debug=/usr/lib/debug/.build-id/$debug_file
pkgname=libdrizzle-redux-dev
genchangelog "$pkgname" "$pkgversion" "$pkgmaint" > "$changelog"
fpm -s dir -t deb -n "$pkgname" -v "$pkgversion" \
--architecture all \
--maintainer "$pkgmaint" \
--description "Simplified API to MySQL databases" \
--url 'https://github.com/sociomantic-tsunami/libdrizzle-redux' \
--vendor 'Sociomantic Labs GmbH' \
--license 'Simplified BSD License' \
--category libdevel \
--depends libdrizzle-redux \
--deb-changelog "$changelog" \
--deb-no-default-config-files \
install/usr/include/=/usr/include/ \
$so_libname=/usr/lib/ \
install/usr/lib/libdrizzle-redux.a=/usr/lib/