-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-deb.sh
executable file
·73 lines (60 loc) · 1.56 KB
/
build-deb.sh
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
#!/bin/bash
# Script to set up a Debian-based Linux environment and build a binary
# distribution package.
dist="$1"
arch="$2"
cd "$(dirname "$0")/.."
base_dir="$PWD"
package_root_dir="$base_dir/dist"
version="$(cat "$base_dir/VERSION")"
deb_file_name="pilrc_${version}~${dist}_${arch}.deb"
if [ "$EUID" -eq 0 ]; then
sudo=
else
sudo='sudo'
fi
function install_build_deps() {
export DEBIAN_FRONTEND=noninteractive
$sudo apt-get -qq update
$sudo apt-get -qq install -y \
build-essential autoconf automake unzip \
> /dev/null # -qq doesn't actually silence apt-get install.
}
function build() {
# Build and install into temp directory.
rm -rf "$package_root_dir"
# See contrib/package
(cd "$base_dir/unix" && \
aclocal && \
automake --add-missing && \
autoconf)
# See unix/pilrc.build and unix/pilrc.spec
env \
prefix=/usr \
DESTDIR="$package_root_dir" \
"$base_dir/unix/pilrc.build"
install -m 0755 "$base_dir/fonts/pilfont" "$package_root_dir/usr/bin/pilfont"
}
function package() {
cd "$package_root_dir"
mkdir -p DEBIAN
cat <<EOF > DEBIAN/control
Package: pilrc
Version: $version
Section: devel
Priority: optional
Architecture: $arch
Depends:
Maintainer: Chuan Ji <chuan@jichu4n.com>
Description: Palm OS resource compiler
PilRC is an application that takes a resource script file and generates
one or more binary resource files that are to be used when developing
for the Palm Computing Platform.
EOF
cd "$base_dir"
dpkg-deb --build "$package_root_dir" "$deb_file_name"
}
set -ex
install_build_deps
build
package