OXYGENHUB
◆ main openmsx / build / package-slackware / openmsx.SlackBuild
7.5 KiB · executable · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
!/bin/sh
2
#
3
# SlackBuild for openMSX
4
# http://openmsx.org/
5
# By SukkoPera <[email protected]>
6
# 27/10/2005
7
#
8
# Thanks a lot to CAT for his Slackware package cration
9
# guide (http://www.slacky.it/misto/tutorial/spunleashed.txt)
10
#
11
# Check out
12
# - http://www.sukkopera.tk
13
# - http://www.slacky.it
14
#
15
# Notes:
16
# - This script will make a package including both openMSX and Catapult.
17
#   Please edit it to suit your needs.
18
# - You'll need catapult.desktop, slack-desc and the openMSX and Catapult
19
#   sources, of course.
20
21
22
# Get the current and temporary directories
23
CWD=`pwd`
24
if [ "$TMP" = "" ]; then
25
 TMP=/tmp/pkg
26
fi
27
28
# Set up working directories
29
if [ ! -d $TMP ]
30
then
31
	mkdir -p $TMP
32
fi
33
34
# Some useful variables about the package
35
NAME=`basename $0 .SlackBuild`
36
PKG=$TMP/package-$NAME
37
VERSION=0.6.0
38
#VERSION=`date +%Y%m%d`
39
ARCH=i686	# Autodetection makes this pkg i686
40
BUILD=2suk
41
SOURCEARCH=$NAME-$VERSION
42
43
# Set compilation flags according to the architecture
44
#case $ARCH in
45
#        "i686")
46
#                SLCKFLAGS="-O2 -march=i686"
47
#                ;;
48
#        "celeron")
49
#                SLCKFLAGS="-Os -march=pentium3"
50
#                ;;
51
#        "pentium3")
52
#                SLCKFLAGS="-O2 -march=pentium3"
53
#                ;;
54
#        "pentium4")
55
#                SLCKFLAGS="-O2 -march=pentium4"
56
#                ;;
57
#        "duron"|"sempron")
58
#                SLCKFLAGS="-Os -march=athlon-xp -m3dnow"
59
#                ;;
60
#        "athlonxp")
61
#                SLCKFLAGS="-O2 -march=athlon-xp -m3dnow"
62
#                ;;
63
#        "x86_64")
64
#                SLCKFLAGS="-O2 -march=athlon64"
65
#                ;;
66
#        "sparc")
67
#                SLCKFLAGS="-O2"
68
#                ;;
69
#        "supersparc")
70
#                SLCKFLAGS="-O2 -mcpu=supersparc"
71
#                ;;
72
#        *|"i486")
73
#                SLCKFLAGS="-O2 -march=i486 -mcpu=i686"
74
#                ;;
75
#esac
76
77
# Add flags common to all architectures
78
#SLCKFLAGS="-pipe -fomit-frame-pointer $SLCKFLAGS"
79
80
81
# Print a welcome screen
82
echo "+-----------------------------------------------------------------------"
83
echo "| $NAME-$VERSION"
84
echo "+-----------------------------------------------------------------------"
85
86
87
if [ -d $PKG ]
88
then
89
	if [ "$1" == "--clean" ]
90
	then
91
		# Clean up a previous build and go on
92
		rm -rf $PKG $TMP/$NAME-$VERSION
93
	else
94
		# Warn the user and stop
95
		echo "Previous package build directory found, please remove it and"
96
		echo "restart the SlackBuild script: $PKG"
97
		exit 1
98
	fi
99
fi
100
101
mkdir -p $PKG
102
103
for i in usr/share/applications usr/share/pixmaps
104
do
105
	echo "--- Creating directory $PKG/$i"
106
	mkdir -p $PKG/$i
107
done
108
109
# Decompress
110
echo "------------------------- Uncompressing source -------------------------"
111
cd $TMP
112
tar zxvf $CWD/$SOURCEARCH.tar.gz
113
#mv $SOURCEARCH $NAME-$VERSION
114
cd $NAME-$VERSION
115
116
# Build
117
#echo "------------------------------ Configuring -----------------------------"
118
#	./configure --prefix=/usr \
119
#	--sysconfdir=/etc \
120
#	--localstatedir=/var
121
122
echo "------------------------------- Patching -------------------------------"
123
# Set installation directory to what we want
124
SUBDEST=/usr/share/openmsx
125
sed -i "s:\(INSTALL_BASE\:=\).*:\1$SUBDEST:" build/custom.mk
126
sed -i "s:\(SYMLINK_FOR_BINARY\:=\).*:\1false:" build/custom.mk
127
128
echo "------------------------------ Compiling -------------------------------"
129
#CFLAGS=$SLCKFLAGS \
130
#CXXFLAGS=$SLCKFLAGS \
131
make INSTALL_SHARE_DIR=$SUBDEST
132
res=$?
133
if [ $res -ne 0 ]
134
then
135
	# make failed, we cannot continue
136
	exit $res
137
fi
138
139
echo "------------------------------ Installing ------------------------------"
140
DOCSDIR=$PKG/usr/doc/$NAME-$VERSION
141
make install OPENMSX_INSTALL=$PKG/$SUBDEST \
142
	INSTALL_SHARE_DIR=$PKG/$SUBDEST \
143
	INSTALL_BINARY_DIR=$PKG/usr/bin \
144
	INSTALL_DOC_DIR=$DOCSDIR
145
146
res=$?
147
if [ $res -ne 0 ]
148
then
149
	# make install failed, we cannot continue
150
	exit 1
151
fi
152
153
# Doc
154
echo "----------------- Copying documentation and other files ----------------"
155
mkdir -p $DOCSDIR
156
for i in AUTHORS GPL README TODO
157
do
158
#        cat $i | gzip > $DOCSDIR/$i.gz
159
        cp -a $i $DOCSDIR
160
done
161
162
163
# GUI
164
echo "--- Compiling Catapult"
165
GUINAME=catapult
166
GUIVERSION=0.6.0_R2
167
GUITNAME=openmsx-catapult
168
GUITVERSION=0.6.0-R2
169
GUISOURCEARCH=$GUITNAME-$GUITVERSION
170
171
# Decompress
172
echo "------------------------- Uncompressing source -------------------------"
173
cd $TMP
174
tar zxvf $CWD/$GUISOURCEARCH.tar.gz
175
mv $GUISOURCEARCH $GUINAME-$GUIVERSION
176
cd $GUINAME-$GUIVERSION
177
178
# Build
179
#echo "------------------------------ Configuring -----------------------------"
180
#	./configure --prefix=/usr \
181
#	--sysconfdir=/etc \
182
#	--localstatedir=/var
183
184
echo "------------------------------- Patching -------------------------------"
185
# Set installation directory to what we want
186
GUISUBDEST=/usr/share/openmsx/catapult
187
sed -i "s:\(INSTALL_BASE\:=\).*:\1$GUISUBDEST:" build/custom.mk
188
sed -i "s:\(SYMLINK_FOR_BINARY\:=\).*:\1false:" build/custom.mk
189
sed -i "s:\(CATAPULT_OPENMSX_BINARY\:=\).*:\1/usr/bin/openmsx:" build/custom.mk
190
sed -i "s:\(CATAPULT_OPENMSX_SHARE\:=\).*:\1/usr/share/openmsx:" build/custom.mk
191
192
echo "------------------------------ Compiling -------------------------------"
193
#CFLAGS=$SLCKFLAGS \
194
#CXXFLAGS=$SLCKFLAGS \
195
make clean
196
make
197
res=$?
198
if [ $res -ne 0 ]
199
then
200
	# make failed, we cannot continue
201
	exit $res
202
fi
203
204
echo "------------------------------ Installing ------------------------------"
205
DOCSDIR=$PKG/usr/doc/$NAME-$VERSION/$GUINAME-$GUIVERSION
206
mkdir -p $DOCSDIR
207
make install CATAPULT_INSTALL=$PKG/$GUISUBDEST \
208
	INSTALL_BINARY_DIR=$PKG/usr/bin \
209
	INSTALL_DOC_DIR=$DOCSDIR
210
211
res=$?
212
if [ $res -ne 0 ]
213
then
214
	# make install failed, we cannot continue
215
	exit 1
216
fi
217
218
# Doc
219
echo "----------------- Copying documentation and other files ----------------"
220
for i in AUTHORS GPL README
221
do
222
#        cat $i | gzip > $DOCSDIR/$i.gz
223
        cp -a $i $DOCSDIR
224
done
225
226
227
228
# Clean a little
229
find $PKG -name .cvsignore -exec rm -f {} \;
230
231
# Gzip man pages
232
#find $PKG/usr/man -name "*.[123456789]" -exec gzip -9 {} \;
233
234
# SlackBuild stuff
235
mkdir -p $PKG/usr/doc/$NAME-$VERSION/slackbuild
236
cp $CWD/{$0,slack-desc} $PKG/usr/doc/$NAME-$VERSION/slackbuild
237
238
# Icon and desktop entry (We're using a custom one because the included one is broken)
239
cp $PKG/usr/share/openmsx/catapult/resources/icons/catapult.xpm $PKG/usr/share/pixmaps
240
cp $CWD/catapult.desktop $PKG/usr/share/applications
241
242
# Remove broken desktop file (not in $PKG!)
243
rm /usr/share/applications/openMSX-Catapult.desktop
244
245
# Strip binaries
246
echo "--------------------------- Stripping binaries -------------------------"
247
find $PKG -type f | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
248
249
# Set permissions
250
echo "--------------------------- Setting permissions ------------------------"
251
chown -R root.bin $PKG/usr/bin $PKG/usr/sbin
252
253
chown -R root.root $PKG/usr/doc
254
chmod -R 755 $PKG/usr/doc/*
255
find $PKG/usr/doc -type f -exec chmod 644 {} \;
256
257
if [ -d $PKG/usr/share ]
258
then
259
	chown -R root.root $PKG/usr/share
260
	chmod -R 755 $PKG/usr/share/*
261
	find $PKG/usr/share -type f -exec chmod 644 {} \;
262
fi
263
264
# Copy Slackware package files
265
echo "--------------------- Copying Slackware package files ------------------"
266
mkdir -p $PKG/install
267
cat $CWD/slack-desc > $PKG/install/slack-desc
268
#cp $CWD/doinst.sh $PKG/install
269
#chmod 755 $PKG/install/doinst.sh
270
#cat $CWD/slack-required > $PKG/install/slack-required
271
272
# Create package
273
echo "---------------------------- Creating package --------------------------"
274
echo "Creating package"
275
cd $PKG
276
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz
277
278
# Clean up
279
if [ "$1" = "--cleanup" ]; then
280
	echo "---------------------- Cleaning up working directory -------------------"
281
	rm -rf $TMP/$NAME-$VERSION
282
	rm -rf $PKG
283
fi
284
285
# Package created
286
echo "Package creation finished!"