Advertisement
Guest User

ponce

a guest
Oct 21st, 2009
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. PRGNAM=wine
  4. SRCVER=${SRCVER:-"1.1.31"}
  5. VERSION=$(echo $SRCVER | tr '-' '.')
  6. ARCH=${ARCH:-"x86_64"}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-ponce}
  9.  
  10. DOCS="ANNOUNCE AUTHORS COPYING.LIB ChangeLog LICENSE* README VERSION"
  11.  
  12. # Set the variable OPENGL to "NO" if you don't have a card that
  13. # supports hardware accelerated OpenGL:
  14. OPENGL=${OPENGL:-"YES"} # Use 'YES' not 'yes' : case-sensitive!
  15.  
  16. # If you set REQUIRE_FONTFORGE to "NO" then the script won't refuse to build
  17. # wine in case you don't have fontforge installed (it is needed to
  18. # generate the required base fonts).
  19. REQUIRE_FONTFORGE=${REQUIRE_FONTFORGE:-"YES"}
  20.  
  21. # Where do we look for sources?
  22. SRCDIR=$(cd $(dirname $0); pwd)
  23.  
  24. # Place to build (TMP) package (PKG) and output (OUTPUT) the program:
  25. TMP=${TMP:-/tmp/txz}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28.  
  29. SOURCE="$SRCDIR/${PRGNAM}-${SRCVER}.tar.bz2"
  30. SRCURL="http://ibiblio.org/pub/linux/system/emulators/${PRGNAM}/${PRGNAM}-${SRCVER}.tar.bz2"
  31.  
  32. ##
  33. ## --- with a little luck, you won't have to edit below this point --- ##
  34. ##
  35.  
  36. # Exit the script on errors:
  37. set -e
  38. trap 'echo "$0 FAILED on line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR
  39. # Catch unitialized variables:
  40. set -u
  41. P1=${1:-1}
  42.  
  43. case "$ARCH" in
  44. i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  45. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  46. ;;
  47. s390) SLKCFLAGS="-O2"
  48. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  49. ;;
  50. powerpc) SLKCFLAGS="-O2"
  51. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  52. ;;
  53. x86_64) SLKCFLAGS="-O2 -fPIC -mtune=native -pipe"
  54. LIBDIRSUFFIX="64"
  55. ;;
  56. athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
  57. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  58. ;;
  59. esac
  60.  
  61. # Prepare a sane build environment:
  62. mkdir -p $TMP/tmp-$PRGNAM # location to build the source
  63. rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build and continue
  64. mkdir -p $PKG # place for the package to be built
  65. rm -rf $PKG/* # We always erase old package's contents
  66. mkdir -p $OUTPUT # place for the package to be saved
  67.  
  68. # Source files availability:
  69. if ! [ -f ${SOURCE} ]; then
  70. if ! [ "x${SRCURL}" == "x" ]; then
  71. # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT
  72. [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename $SOURCE)"
  73. echo "Source '$(basename ${SOURCE})' not available yet..."
  74. echo "Will download file to $(dirname $SOURCE)"
  75. wget -nv -T 20 -O "${SOURCE}" "${SRCURL}" || true
  76. if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then
  77. echo "Downloading '$(basename ${SOURCE})' failed... aborting the build."
  78. mv -f "${SOURCE}" "${SOURCE}".FAIL
  79. exit 1
  80. fi
  81. else
  82. echo "File '$(basename ${SOURCE})' not available... aborting the build."
  83. exit 1
  84. fi
  85. fi
  86.  
  87. if [ "$P1" == "--download" ]; then
  88. echo "Download complete."
  89. exit 0
  90. fi
  91.  
  92. # --- PACKAGE BUILDING ---
  93.  
  94. echo "++"
  95. echo "|| $PRGNAM-$VERSION"
  96. echo "++"
  97.  
  98. if ! which fontforge >/dev/null 2>&1 ; then
  99. echo "##"
  100. echo "## The 'fontforge' program does not seem to be installed."
  101. echo "## Wine uses fontforge to generate several TTF fonts (tahoma,tahomabd,marlett)"
  102. echo "## that your Windows programs may want to use!"
  103. if [ "$REQUIRE_FONTFORGE" != "YES" ]; then
  104. echo "##"
  105. echo "## Continuing the build anyway, but you were warned..."
  106. echo "## Sleeping for 5 seconds, press <Ctrl>-C if you want to abort now."
  107. echo "##"
  108. sleep 5
  109. else
  110. echo "##"
  111. echo "## Aborting the build - set the internal script variable:"
  112. echo "##"
  113. echo "## 'REQUIRE_FONTFORGE' to a value of 'NO'"
  114. echo "##"
  115. echo "## if you don't want to use fontforge to generate TTF fonts."
  116. echo "##"
  117. exit 1
  118. fi
  119. fi
  120.  
  121. cd $TMP/tmp-$PRGNAM
  122.  
  123. echo "Extracting the source archive(s) for $PRGNAM..."
  124. tar -xvf ${SOURCE}
  125. [ "$SRCVER" != "$VERSION" ] && mv ${PRGNAM}-${SRCVER} ${PRGNAM}-${VERSION}
  126. cd ${PRGNAM}-${VERSION}
  127. # Starting with openssl-0.9.8h, a typedef was introduced named "X509_EXTENSIONS"
  128. # into openssl/x509.h. Unfortunately, wine uses a define of the same name
  129. # in include/wincrypt.h. You may need this patch:
  130. #patch -p0 < $SRCDIR/wine_openssl.patch
  131. chown -R root:root .
  132. chmod -R u+w,go+r-w,a-s .
  133.  
  134. #cat $CWD/depth_patch | patch -p1
  135.  
  136. echo Building ...
  137.  
  138. [ "${OPENGL}" = "YES" ] && do_opengl="" || do_opengl="out"
  139.  
  140. CFLAGS="$SLKCFLAGS" \
  141. CXXFLAGS="$SLKCFLAGS" \
  142. ./configure \
  143. --prefix=/usr \
  144. --libdir=/usr/lib${LIBDIRSUFFIX} \
  145. --localstatedir=/var \
  146. --sysconfdir=/etc \
  147. --mandir=/usr/man \
  148. --disable-tests\
  149. --with-x \
  150. --with${do_opengl}-opengl \
  151. --program-prefix= \
  152. --program-suffix= \
  153. --build=$ARCH-slackware-linux \
  154. 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log
  155. make depend 2>&1 | tee $OUTPUT/make-${PRGNAM}.log
  156. make -j2 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log
  157. make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log
  158.  
  159. # Add a desktop menu for the winecfg program:
  160. mkdir -p $PKG/usr/share/pixmaps
  161. cp -a programs/winemenubuilder/wine.xpm $PKG/usr/share/pixmaps/
  162. mkdir -p $PKG/usr/share/applications
  163. cat <<-_EOT_ > $PKG/usr/share/applications/winecfg.desktop
  164. [Desktop Entry]
  165. Exec=winecfg
  166. Icon=/usr/share/pixmaps/wine.xpm
  167. Terminal=false
  168. Name=Wine Configuration
  169. Comment=Configure Wine
  170. Type=Application
  171. Categories=Application;Settings
  172. _EOT_
  173.  
  174. # Add some documentation to the package:
  175. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  176. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
  177. cp -a $SRCDIR/$(basename $0) $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  178. chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
  179. find $PKG/usr/doc -type f -exec chmod 644 {} \;
  180.  
  181. # Compress the man page(s)
  182. if [ -d $PKG/usr/man ]; then
  183. cd $PKG/usr/man
  184. find . -type f -name "*.?" -exec gzip -9f {} \;
  185. for i in $(find . -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  186. fi
  187.  
  188. # Strip binaries
  189. cd $PKG
  190. find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  191. find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  192. cd -
  193.  
  194. # Add a package description:
  195. mkdir -p $PKG/install
  196. cat $SRCDIR/slack-desc > $PKG/install/slack-desc
  197. if [ -f $SRCDIR/doinst.sh ]; then
  198. cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh
  199. fi
  200. if [ -f $SRCDIR/slack-required ]; then
  201. cat $SRCDIR/slack-required > $PKG/install/slack-required
  202. fi
  203.  
  204. # Build the package:
  205. cd $PKG
  206. makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txz 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log
  207.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement