summaryrefslogtreecommitdiffstats
path: root/development/cosmocc/cosmocc.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'development/cosmocc/cosmocc.SlackBuild')
-rw-r--r--development/cosmocc/cosmocc.SlackBuild89
1 files changed, 89 insertions, 0 deletions
diff --git a/development/cosmocc/cosmocc.SlackBuild b/development/cosmocc/cosmocc.SlackBuild
new file mode 100644
index 0000000000..b8f92c53b3
--- /dev/null
+++ b/development/cosmocc/cosmocc.SlackBuild
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+# Slackware build script for cosmocc
+
+# Originally written 2024 Juan M. Lasca <email removed>
+# Modified and now maintained by B. Watson <urchlay@slackware.uk>
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+# 20240312 bkw:
+# - update for v3.3.2.
+# - use wrapper script rather than symlinks for /usr/bin/* since the
+# symlinks didn't actually work.
+
+# 20240219 bkw: BUILD=3
+# - Take over maintenance.
+# - Relicense as WTFPL.
+# - Fix permission error in package, when $CWD files are not owned by root.
+# - Do not install upstream's licenses .xz compressed.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=cosmocc
+VERSION=${VERSION:-3.3.2}
+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
+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}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+mkdir $PRGNAM-$VERSION
+cd $PRGNAM-$VERSION
+unzip $CWD/$PRGNAM-$VERSION.zip
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
+
+mkdir -p $PKG/opt/$PRGNAM/scripts $PKG/usr/bin
+install -m0755 -oroot -groot $CWD/scripts/* $PKG/opt/$PRGNAM/scripts
+
+for i in bin include x86_64-linux-cosmo aarch64-linux-cosmo libexec; do
+ mv $i $PKG/opt/$PRGNAM
+done
+
+install -oroot -groot -m0755 $CWD/wrapper.sh $PKG/opt/$PRGNAM/bin/wrapper.sh
+
+# 20240312 bkw: can't use symlinks for these, or else we get:
+# /usr/bin/cosmocc: line 327: /usr/bin/x86_64-linux-cosmo-gcc: No such file or directory
+for i in mktemper march-native zipcopy apelink cosmocross cosmoar \
+ assimilate zipobj cosmoaddr2line cosmocc mkdeps cosmoc++ \
+ cosmoinstall pecheck
+do
+ ln -s ../../opt/$PRGNAM/bin/wrapper.sh $PKG/usr/bin/$i
+done
+
+# remove empty directories:
+rmdir $PKG/opt/cosmocc/libexec/gcc/{x86_64,aarch64}-linux-cosmo/*/install-tools || true
+
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -a LICENSE.*gpl* README.md $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE