forked from garglk/garglk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gargoyle-builddeb.sh
executable file
·159 lines (139 loc) · 5.36 KB
/
gargoyle-builddeb.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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
# This scripts creates and builds a simple Gargoyle DEB package
#
# Prerequisites:
# - dpkg-deb tools must be installed.
#
# By default, a TADS icon (application-x-tads.png) is included, but
# this is also provded by QTads. Build with the -t flag to avoid
# installation of this icon.
set -e
while getopts "t" o
do
case "${o}" in
t)
NO_TADS_ICON=1
;;
*)
exit 1
;;
esac
done
# Setup working vars for deb build. These can be changed as needed for different revisions or build environments.
PROJECT=gargoyle
VERSION=$(<VERSION)
PACKAGEREV=1
ARCH=amd64
DEB_ROOT_DIR=~/deb_factory
PKG_NAME=${PROJECT}_${VERSION}-${PACKAGEREV}
PKG_DIR=${DEB_ROOT_DIR}/${PKG_NAME}/debian/tmp
PKG_DEB_ROOT=${DEB_ROOT_DIR}/${PKG_NAME}/debian
#Build Gargoyle
mkdir build-debian
pushd build-debian
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
make -j$(nproc)
make install DESTDIR=${PKG_DIR}
popd
if [[ -n "${NO_TADS_ICON}" ]]
then
rm "${PKG_DIR}/usr/share/icons/hicolor/32x32/mimetypes/application-x-tads.png"
fi
#Create necessary directories not created by "make install"
mkdir -p ${PKG_DIR}/etc
mkdir -p ${PKG_DIR}/usr/share/doc/${PROJECT}
mkdir -p ${PKG_DIR}/DEBIAN
#Switch into the deb root directory and create the various control files dpkg needs to build a deb package.
pushd ${PKG_DEB_ROOT}
#Create a small script to envoke gargoyle with to avoid having the git interpreter confused with the git SCM binary.
echo -e '#!/bin/sh\n/usr/lib/gargoyle/gargoyle &\nexit' > gargoyle-free
chmod +x gargoyle-free
#Create a desktop entry so gargoyle can be started without having to open the cmd line.
cat > ${PROJECT}.desktop <<'EOF'
[Desktop Entry]
Name=gargoyle-free
Comment=Interactive fiction interpreter / player supporting many formats.
Exec=gargoyle-free
Icon=io.github.garglk.Gargoyle
Categories=Game;Emulator;
Type=Application
Terminal=0
X-Desktop-File-Install-Version=0.3
EOF
#Move the launcher script and the desktop entry into the temp directory structure.
mv ./gargoyle-free ./tmp/usr/bin
mv ./gargoyle.desktop ./tmp/usr/share/applications
#Write out a simple control file template. This file will be used by dkpg-gencontrol in order to generate the final debian control file that includes dynamically determined library dependencies. The library dependencies are generated using dpkg-shlibdeps.
cat > control << EOF
Source: gargoyle-free
Maintainer: Chris Spiegel <[email protected]>
Package: gargoyle-free
Priority: extra
Architecture: $ARCH
EOF
cat >> control << 'EOF'
Depends: ${shlibs:Depends}
Description: graphical player for Interactive Fiction games
Gargoyle is an Interactive Fiction (text adventure) player that
supports all the major interactive fiction formats.
.
Most interactive fiction is distributed as portable game files. These
portable game files come in many formats. In the past, you used to
have to download a separate player (interpreter) for each format of
IF you wanted to play. Instead, Gargoyle provides unified player.
.
Gargoyle is based on the standard interpreters for the formats it
supports: .taf (Adrift games, played with Scare), .dat (AdvSys),
*.agx/.d$$ (AGiliTy), .a3c (Alan3), .jacl/.j2 (JACL), .l9/.sna (Level
9), .mag (Magnetic), *.saga (Scott Adams Grand Adventures), .gam/.t3
(TADS), *.z1/.z2/.z3/.z4/.z5/.z6/.z7/.z8/.zlb/.zblorb (Inform
Z-Machine games, played with Bocfel), .ulx/.blb/.blorb/.glb/.gblorb
(Inform or Superglús games compiled to the Glulxe VM in Blorb
archives, played with Git or Glulxe).
.
(note: do not confuse the Git Glux interpreter with the Git DVCS or
the GNU Interactive Tools)
.
Gargoyle also features graphics, sounds and Unicode support.
.
Technically all the bundled interpreters support the Glk API to
manage I/O (keyboard, graphics, sounds, file) in IF games. Gargoyle
provides a Glk implementation called garglk that displays texts and
images in a graphical Gtk window, with care on typography.
.
Limitations:
.
* While Gargoyle can display in-game pictures, it does not provide a
way to display the cover art present in some Blorb archives.
.
* The TADS interpreter doesn't support HTML TADS; you can play
the games, but will miss the hyperlinks.
EOF
#Write out a simple change log, dpkg-gencontrol refuses to run without one.
cat > changelog << EOF
gargoyle-free (${VERSION}) sid; urgency=low
* Binary-only non-maintainer package for amd64; no source changes.
* Building for most recent version of Gargoyle.
EOF
popd
#Move into the package directory to generate library dependency list and the final control file.
pushd ${DEB_ROOT_DIR}/${PKG_NAME}
#Make the libgarglk.so visible in LD_LIBRARY_PATH so dpkg-shlibdeps does not complain it cannot find it.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PKG_DIR}/usr/lib/${PROJECT}
#Determine dependencies and write out final control file.
dpkg-shlibdeps ./debian/tmp/usr/libexec/${PROJECT}/* ./debian/tmp/usr/lib/*/libgarglk.so
dpkg-gencontrol -v${VERSION}
#Remove the control template, copy the package contents to final packaging location, remove temp directories as needed.
rm -rfv ./debian/control
mkdir ./DEBIAN
cp -v ./debian/tmp/DEBIAN/control ./DEBIAN/control
mv ${PKG_DIR}/etc ./
mv ${PKG_DIR}/usr ./
cp -v ./debian/changelog ./usr/share/doc/${PROJECT}/changelog
rm -rfv ./debian
popd
#Build the actual debian package and clean up.
pushd ${DEB_ROOT_DIR}
dpkg-deb --build ${PKG_NAME}
rm -rfv ${PKG_NAME}
popd