From b35c1db3d9e22063af353d7c7cb7b70da48fcd23 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 22 May 2013 20:50:43 +0000 Subject: Fixed the compilation on Slackware current (14.1) --- tigervnc/build/tigervnc.SlackBuild | 327 +++++++++++++------------------------ 1 file changed, 113 insertions(+), 214 deletions(-) (limited to 'tigervnc') diff --git a/tigervnc/build/tigervnc.SlackBuild b/tigervnc/build/tigervnc.SlackBuild index 2101f5e5..0201be13 100755 --- a/tigervnc/build/tigervnc.SlackBuild +++ b/tigervnc/build/tigervnc.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh # $Id$ -# Copyright 2010, 2011, 2012 Eric Hameleers, Eindhoven. NL +# Copyright 2010, 2011, 2012, 2013 Eric Hameleers, Eindhoven. NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for @@ -45,21 +45,20 @@ # on Slackware 14 as well. Also, enable compositing in the # server. Abandon the tigervnc-1.2 branch for now, because # the fltk based viewer rewrite is not yet fully functional. -# -# Run 'sh tigervnc.SlackBuild' to build a Slackware package. -# The package (.txz) and .txt file as well as build logs are created in /tmp . -# Install it using 'installpkg'. -# +# 1.1.0-3: 22/may/2013 by Eric Hameleers +# * Build 1.1.0 again, on slackware-current (nee 14.1) with new +# X.Org 1.13 patches. # ----------------------------------------------------------------------------- -# Set initial variables: - -PRGNAM=tigervnc +PKGNAM=tigervnc VERSION=${VERSION:-1.1.0} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} NUMJOBS=${NUMJOBS:" -j4 "} TAG=${TAG:-alien} +# Do we build the java applet (needs jdk)? +DO_APPLET=${DO_APPLET:-"YES"} + # TigerVNC needs to use source of the X.Org server whose version matches # that of your installed X.Org package: XORG=${XORG:-$(X -version 2>&1 | grep "^X.Org X Server " | cut -f4 -d' ')} @@ -74,229 +73,134 @@ BUILDER="Built by Alien BOB on $(date -u)" DOCS="LICENCE.TXT doc/TODO doc/*.txt doc/*.odt" DOCS_XORG="COPYING ChangeLog" -# Where do we look for sources? -SRCDIR=$(cd $(dirname $0); pwd) - -# Place to build (TMP) package (PKG) and output (OUTPUT) the program: -TMP=${TMP:-/tmp/build} -PKG=$TMP/package-$PRGNAM -OUTPUT=${OUTPUT:-/tmp} - -# If you want automatic download to work, supply a URL for 'SRCURL' below: -SOURCE[0]="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz" -SRCURL[0]="http://downloads.sourceforge.net/$PRGNAM/${PRGNAM}-${VERSION}.tar.gz" - -SOURCE[1]="$SRCDIR/xorg-server-${XORG}.tar.gz" -SRCURL[1]="http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-${XORG}.tar.gz" - -# Use the src_checkout() function if no downloadable tarball exists. -# This function checks out sources from SVN/CVS and creates a tarball of them. -src_checkout() { - # Param #1 : index in the SOURCE[] array. - # Param #2 : full path to where SOURCE[$1] tarball should be created. - # Determine the tarball extension: - PEXT=$(echo "${2}" | sed -r -e 's/.*[^.].(tar.xz|tar.gz|tar.bz2|tgz).*/\1/') - case "$PEXT" in - "tar.xz") TARCOMP="J" ;; - "tar.gz") TARCOMP="z" ;; - "tgz") TARCOMP="z" ;; - "tar.bz2") TARCOMP="j" ;; - *) echo "Archive can only have extension 'tar.xz', '.tar.gz' '.tar.bz2' or '.tgz'" ; exit 1 ;; - esac - case ${1} in - 0) # This example assumes a SVN checkout: - if [ "$(echo ${VERSION}|cut -c1)" == 'r' ]; then # revision instead of date - REV=$(echo ${VERSION} | cut -c2-) - else - REV="{${VERSION}}" - fi - mkdir $PRGNAM-${VERSION} \ - && cd $PRGNAM-${VERSION} \ - && svn checkout --revision $REV https://tigervnc.svn.sourceforge.net/svnroot/tigervnc/trunk/ . \ - && find . -type d -name '.svn' -depth | xargs rm -rf \ - && chown -R root:root . \ - && cd .. \ - && tar -${TARCOMP}cf ${2} $PRGNAM-${VERSION} - rm -rf $PRGNAM-${VERSION} - ;; - *) # Do nothing - ;; - esac -} - -## -## --- with a little luck, you won't have to edit below this point --- ## -## - -# Automatically determine the architecture we're building on: -MARCH=$( uname -m ) -if [ -z "$ARCH" ]; then - case "$MARCH" in - i?86) export ARCH=i486 ;; - armv7hl) export ARCH=$MARCH ;; - arm*) export ARCH=arm ;; - # Unless $ARCH is already set, use uname -m for all other archs: - *) export ARCH=$MARCH ;; - esac +if [ -e $CWD/machine.conf ]; then + . $CWD/machine.conf ] +elif [ -e /etc/slackbuild/machine.conf ]; then + . /etc/slackbuild/machine.conf ] +else + # Automatically determine the architecture we're building on: + MARCH=$( uname -m ) + if [ -z "$ARCH" ]; then + case "$MARCH" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$MARCH ;; + esac + fi + # Set CFLAGS/CXXFLAGS and LIBDIRSUFFIX: + if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" + elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv5te" + LIBDIRSUFFIX="" + else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + fi fi case "$ARCH" in - i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - x86_64) SLKCFLAGS="-O2 -fPIC" - SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" - ;; - armv7hl) SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - *) SLKCFLAGS="-O2" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; -esac - -case "ARCH" in - arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; - *) TARGET=$ARCH-slackware-linux ;; + arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; + *) TARGET=$ARCH-slackware-linux ;; esac -# Exit the script on errors: -set -e -trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR -# Catch unitialized variables: -set -u -P1=${1:-1} - -# Save old umask and set to 0022: -_UMASK_=$(umask) -umask 0022 - -# Create working directories: -mkdir -p $OUTPUT # place for the package to be saved -mkdir -p $TMP/tmp-$PRGNAM # location to build the source -mkdir -p $PKG # place for the package to be built -rm -rf $PKG/* # always erase old package's contents -rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build -rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log - # remove old log files - -# Source file availability: -for (( i = 0; i < ${#SOURCE[*]}; i++ )) ; do - if ! [ -f ${SOURCE[$i]} ]; then - echo "Source '$(basename ${SOURCE[$i]})' not available yet..." - # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT - [ -w "$SRCDIR" ] || SOURCE[$i]="$OUTPUT/$(basename ${SOURCE[$i]})" - if [ -f ${SOURCE[$i]} ]; then echo "Ah, found it!"; continue; fi - if ! [ "x${SRCURL[$i]}" == "x" ]; then - echo "Will download file to $(dirname $SOURCE[$i])" - wget -nv -T 20 -O "${SOURCE[$i]}" "${SRCURL[$i]}" || true - if [ $? -ne 0 -o ! -s "${SOURCE[$i]}" ]; then - echo "Fail to download '$(basename ${SOURCE[$i]})'. Aborting the build." - mv -f "${SOURCE[$i]}" "${SOURCE[$i]}".FAIL - exit 1 - fi - else - # Try if we have a SVN/CVS download routine for ${SOURCE[$i]} - echo "Will checkout sources to $(dirname $SOURCE[$i])" - src_checkout $i "${SOURCE[$i]}" \ - 2>&1 > $OUTPUT/checkout-$(basename ${SOURCE[$i]}).log - fi - if [ ! -f "${SOURCE[$i]}" -o ! -s "${SOURCE[$i]}" ]; then - echo "File '$(basename ${SOURCE[$i]})' not available. Aborting the build." - exit 1 - fi - fi -done - -if [ "$P1" == "--download" ]; then - echo "Download complete." - exit 0 -fi - -# --- PACKAGE BUILDING --- +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/pkg-$PKGNAM -echo "++" -echo "|| $PRGNAM-$VERSION" -echo "++" - -cd $TMP/tmp-$PRGNAM -echo "Extracting the source archive(s) for $PRGNAM..." -for (( i = 0; i < ${#SOURCE[*]}; i++ )) ; do - tar -xvf ${SOURCE[$i]} -done -cd ${PRGNAM}-${VERSION} +rm -rf $PKG +mkdir -p $TMP $PKG +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1 +tar xvf $CWD/xorg-server-${XORG}.tar.?z* || exit 1 +cd $PKGNAM-$VERSION || exit 1 # Move the xorg-server sources into the TigerVNC tree: mv unix/xserver/hw/vnc ../xorg-server-${XORG}/hw/ rm -rf unix/xserver/hw mv ../xorg-server-${XORG}/* unix/xserver/ -touch $OUTPUT/patch-$PRGNAM.log - # We have patches for X.Org later than 1.10 which tigervnc does not have: for PATCHVER in 111 112 113 ; do - if [ -e $SRCDIR/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg${PATCHVER}.patch ]; then - cp $SRCDIR/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg${PATCHVER}.patch unix/xserver${PATCHVER}.patch + if [ -e $CWD/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg${PATCHVER}.patch ]; then + cp $CWD/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg${PATCHVER}.patch unix/xserver${PATCHVER}.patch fi done if [ $MAXPATCHVER -gt 110 ]; then - # The sed magic in the hw/vnc Makefile needs some love: - # ... taken care of in the xserver113 patch if we ever move to X.Org 1.13. - cat $SRCDIR/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg_headers.patch | patch -p1 --verbose \ - 2>&1 | tee -a $OUTPUT/patch-$PRGNAM.log + if [ $MAXPATCHVER -lt 113 ]; then + # The sed magic in the hw/vnc Makefile needs some love: + # ... taken care of in the xserver113 patch if we ever move to X.Org 1.13. + cat $CWD/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg_headers.patch | patch -p1 --verbose || exit 1 + else + # We need to rewrite the xserver110.patch for X.Org 1.13 and newer: + cp $CWD/tigervnc$(echo $VERSION | cut -f1,2 -d. --output-delimiter=)-xorg110.patch unix/xserver110.patch + fi fi # Patch the xorg-server source to include building the vnc driver cd unix/xserver if [ $MAXPATCHVER -le 110 ]; then # apply one of the tigervnc-provided patches: - cat ../xserver${MAXPATCHVER}.patch | patch -p1 --verbose \ - 2>&1 | tee -a $OUTPUT/patch-$PRGNAM.log + cat ../xserver${MAXPATCHVER}.patch | patch -p1 --verbose || exit 1 else # these external patches are incremental and must be applied in order: - for PATCHVER in 110 111 112 ; do + for PATCHVER in 110 111 112 113 ; do if [ $PATCHVER -le $MAXPATCHVER -a -e ../xserver${PATCHVER}.patch ]; then - cat ../xserver${PATCHVER}.patch | patch -p1 --verbose \ - 2>&1 | tee -a $OUTPUT/patch-$PRGNAM.log + cat ../xserver${PATCHVER}.patch | patch -p1 --verbose || exit 1 fi done fi cd - +# We use Java7: +cat $CWD/tigervnc11-java7.patch | patch -p1 --verbose || exit 1 + # Explicitly put the java applet into a directory named 'tigervnc': sed -i -e 's#/vnc/class#/tigervnc/class#'g $(grep -rl vnc/class .) +# Make sure ownerships and permissions are sane: chown -R root:root . -chmod -R u+w,go+r-w,a+X-s . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; -echo Building ... export LDFLAGS="$SLKLDFLAGS -lpthread" export CXXFLAGS="$SLKCFLAGS" export CFLAGS="$SLKCFLAGS" echo -e "\n*** Building tigervnc ***\n" -autoreconf -vif 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log +autoreconf -vif ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ - --docdir=/usr/doc/$PRGNAM-$VERSION \ + --docdir=/usr/doc/$PKGNAM-$VERSION \ --localstatedir=/var \ --sysconfdir=/etc \ --disable-static \ --program-prefix= \ --program-suffix= \ - --build=$TARGET \ - 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log + --build=$TARGET -make $NUMJOBS 2>&1 | tee $OUTPUT/make-${PRGNAM}.log -make DESTDIR=$PKG install 2>&1 | tee $OUTPUT/install-${PRGNAM}.log +make $NUMJOBS || make || exit 1 +make DESTDIR=$PKG install || exit 1 cd unix/xserver echo -e "\n*** Building xserver ***\n" export CXXFLAGS="$SLKCFLAGS -fpermissive" - autoreconf -vif 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log + autoreconf -vif # Default font paths to be used by the X server DEF_FONTPATH="/usr/share/fonts/local,/usr/share/fonts/TTF,/usr/share/fonts/OTF,/usr/share/fonts/Type1,/usr/share/fonts/misc,/usr/share/fonts/CID,/usr/share/fonts/75dpi/:unscaled,/usr/share/fonts/100dpi/:unscaled,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/cyrillic" @@ -326,31 +230,37 @@ cd unix/xserver --disable-config-dbus \ --disable-config-hal \ --disable-config-udev \ + --disable-devel-docs \ + --disable-unit-tests \ + --without-dtrace \ --with-os-name="$OSNAME" \ --with-os-vendor="$OSVENDOR" \ --with-builderstring="$BUILDER" \ - --build=$TARGET \ - 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log + --build=$TARGET - make $NUMJOBS 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log - make -C hw/vnc DESTDIR=$PKG install 2>&1 | tee -a $OUTPUT/install-${PRGNAM}.log + make $NUMJOBS || make || exit 1 + make -C hw/vnc DESTDIR=$PKG install cd - -# Compile the java applet (needs the sdk... jre is not enough): -cd java/src/com/tigervnc/vncviewer - make 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log -cd - +if [ "$DO_APPLET" = "YES" ]; then + # Compile the java applet (needs the sdk... jre is not enough): + cd java/src/com/tigervnc/vncviewer + make || exit 1 + cd - +fi # Create .png icons from the .svg file: -make -C media 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log - -# Install the java applet: -cd java/src/com/tigervnc/vncviewer - mkdir -p $PKG/usr/share/tigervnc/classes - install -m0755 VncViewer.jar $PKG/usr/share/tigervnc/classes/ - install -m0644 index.vnc $PKG/usr/share/tigervnc/classes/ - install -m0644 *.class $PKG/usr/share/tigervnc/classes/ -cd - +make -C media + +if [ "$DO_APPLET" = "YES" ]; then + # Install the java applet: + cd java/src/com/tigervnc/vncviewer + mkdir -p $PKG/usr/share/tigervnc/classes + install -m0755 VncViewer.jar $PKG/usr/share/tigervnc/classes/ + install -m0644 index.vnc $PKG/usr/share/tigervnc/classes/ + install -m0644 *.class $PKG/usr/share/tigervnc/classes/ + cd - +fi # Install menu entry: mkdir -p $PKG/usr/share/{applications,icons/hicolor/{16x16,24x24,32x32,48x48}/apps} @@ -399,11 +309,10 @@ fi EOT # Add documentation: -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true -for FIL in $(echo $DOCS_XORG); do cp -a unix/xserver/$FIL $PKG/usr/doc/$PRGNAM-$VERSION/${FIL}.xorg ; done || true -cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild -chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION +cp -a $DOCS $PKG/usr/doc/$PKGNAM-$VERSION || true +for FIL in $(echo $DOCS_XORG); do cp -a unix/xserver/$FIL $PKG/usr/doc/$PKGNAM-$VERSION/${FIL}.xorg ; done +chown -R root:root $PKG/usr/doc/$PKGNAM-$VERSION find $PKG/usr/doc -type f -exec chmod 644 {} \; # Compress the man page(s): @@ -414,26 +323,16 @@ fi # Strip binaries (if any): find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null # Add a package description: mkdir -p $PKG/install -cat $SRCDIR/slack-desc > $PKG/install/slack-desc -if [ -f $SRCDIR/doinst.sh ]; then - cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc +if [ -f $CWD/doinst.sh.gz ]; then + zcat $CWD/doinst.sh.gz >> $PKG/install/doinst.sh fi # Build the package: cd $PKG -makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz} 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log -cd $OUTPUT -md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz} > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}.md5 -cd - -cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt -if [ -f $PKG/install/slack-required ]; then - cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.dep -fi - -# Restore the original umask: -umask ${_UMASK_} +/sbin/makepkg -l y -c n $TMP/${PKGNAM}-${VERSION}-${ARCH}-${BUILD}.txz -- cgit v1.2.3-79-gdb01