openmsx.SlackBuild 7.5 KB

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