diff options
Diffstat (limited to 'libraries/gtkada/gtkada.SlackBuild')
-rw-r--r-- | libraries/gtkada/gtkada.SlackBuild | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/libraries/gtkada/gtkada.SlackBuild b/libraries/gtkada/gtkada.SlackBuild new file mode 100644 index 0000000000..b398f3b30b --- /dev/null +++ b/libraries/gtkada/gtkada.SlackBuild @@ -0,0 +1,156 @@ +#!/bin/bash +# GTKAda package build script (written by zhu.qunying@gmail.com) +# Copyright 2012-2025, Zhu Qun-Ying +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=gtkada +VERSION=${VERSION:-25.0.1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$(uname -m) ;; + esac + export ARCH +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" + LIB_ARCH=i386 +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + LIB_ARCH=amd64 +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + LIB_ARCH=$ARCH +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT + +cd $TMP +rm -rf $PRGNAM-$VERSION +mkdir $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz + +cd $PRGNAM-$VERSION +chown -R root:root . +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 {} \; || exit 1 + +sed -i -e "s/18.0w/$VERSION/" configure + +sed -i 's/PRJDIR=lib\/gnat/PRJDIR=share\/gpr/' Makefile.in + +#autoreconf -vis +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --includedir=/usr/include \ + --infodir=/usr/info \ + --mandir=/usr/man \ + --enable-shared \ + --with-GL=no \ + --build=$ARCH-slackware-linux + +if [ "$ARCH" = "x86_64" ]; then + sed -i -e "s/lib\/gnat/share\/gpr/g" \ + -e "s/prefix}\/lib/prefix}\/lib$LIBDIRSUFFIX/" \ + -e "s/lib64\/gnat/share\/gpr/g" \ + -e "s/lib\/gtkada/lib$LIBDIRSUFFIX\/gtkada/g"\ + -e 's/=\${libdir}\//=\${DESTDIR}\${libdir}\//' \ + -e 's/include\/gtkada\/gtkada.$(@F)/include\/gtkada/g' \ + -e 's/include\/gtkada\/gtkada_gl.$(@F)/include\/gtkada/g' \ + -e 's/lib64\/gtkada\/gtkada.$(@F)/lib64\/gtkada\/$(@F)/g' \ + -e 's/lib64\/gtkada\/gtkada_gl.$(@F)/lib64\/gtkada\/$(@F)/g' \ + -e 's/--install-name=gtkada//g' Makefile + + sed -i "s/\/lib/\/lib$LIBDIRSUFFIX/g" gtk.gpr +else + sed -i -e "s/lib\/gnat/share\/gpr/g" \ + -e 's/=\${libdir}\//=\${DESTDIR}\${libdir}\//' \ + -e 's/include\/gtkada\/gtkada.$(@F)/include\/gtkada/g' \ + -e 's/include\/gtkada\/gtkada_gl.$(@F)/include\/gtkada/g' \ + -e 's/lib\/gtkada\/gtkada.$(@F)/lib\/gtkada\/$(@F)/g' \ + -e 's/lib\/gtkada\/gtkada_gl.$(@F)/lib\/gtkada\/$(@F)/g' \ + -e 's/--install-name=gtkada//g' Makefile +fi + +sed -i 's/share\/doc/doc/g' src/gtkada.gpr +# change document location +sed -i "s/share\/doc\//doc\//" xml/gtkada.xml +( +# unset the BUILD environment variable in subshell to avoid conflicting +# definition for gtkada project in the gitlab CI environment. +unset BUILD +ADA_FLAGS="$SLKCFLAGS" +LDFLAGS="-s" +make -j1 PROCESSORS=1 GPRBUILD_SWITCHES="-R -XBUILD=Production -cargs $ADA_FLAGS -largs $LDFLAGS -gargs" + +make -j1 PROCESSORS=1 DESTDIR=$PKG install +) + +# static-pic and relocatable are the same ali files +(cd $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/static-pic; + for ali_file in *.ali ; do + ln -sf ../relocatable/$ali_file + done) +mkdir -p $PKG/install +(cd $PKG/usr/share/examples/gtkada + rm lib$LIBDIRSUFFIX + ln -s ../../../lib$LIBDIRSUFFIX +) +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp COPYING* ANNOUNCE README.md $PKG/usr/doc/$PRGNAM-$VERSION +cp $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION +cp $CWD/slack-desc $PKG/install + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |