aboutsummaryrefslogtreecommitdiff
path: root/development/opencomal/opencomal.SlackBuild
blob: 8860b8bf221035fa4ae6e5861f3cac32b4ca43c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash

# Slackware build script for opencomal

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 20250114 bkw: updated for v0.2.11.
# - added file(1) magic for saved opencomal programs.
# Upstream resumed development after a long hiatus, so there might be
# more updates in the future.

# I copy/pasted this from upstream's README:
#   Comal is a crossover between Basic and Pascal, with
#   the best features of both and none of the drawbacks of either.
# ...but it's not quite true: Comal requires line numbers. I consider
# this a drawback to any programming language. Also, unlike Pascal,
# there's no compiler for it (that I know of). *Shrug*.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=opencomal
VERSION=${VERSION:-0.2.11}
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}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
else
  SLKCFLAGS="-O2"
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION

# 20250114 bkw: for easier cleanup, extract into a dir with the
# version number in it (the tarball just contains opencomal/).
mkdir $PRGNAM-$VERSION
cd $PRGNAM-$VERSION

# 20250114 bkw: fancy tar command. There's a bunch of extra junk
# in the tarball, let's not even extract it.
# - The bin/* dir contains prebuilt MacOSX binaries.
# - src/*.d and src/*.o are by-products of an OSX compile.
# - Not packaging the 'playground' webapp, so we don't need www/.
# - Useless ._whatever files (editor backups?)
# - Couple of .gitignore.
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz \
        --wildcards \
        --strip-components=1 \
        --exclude='*/bin/*' \
        --exclude='*/www/*' \
        --exclude='*/src/*.d' \
        --exclude='*/src/*.o' \
        --exclude='*/._*' \
        --exclude='*/*/._*' \
        --exclude='*/*/*/._*' \
        --exclude='*/.gitignore' \
        --exclude='*/*/.gitignore' \
        --exclude='*/*/*/.gitignore'

# 20250114 bkw: don't trust the tarball permissions.
chown -R root:root .
find . -type d -exec chmod 755 {} + -o -type f -exec chmod 644 {} +

# 20250114 bkw: the patches I created for 0.2.6 have all been applied
# upstream, so they're gone. makefile.diff just sets the default OS
# to Linux and disables memory leak detection. Yes, there are leaks,
# but it's not real helpful to have the program say so on exit. Also,
# remove the need for tools/genversion to be +x.
patch -p1 < $CWD/makefile.diff

# not 100% sure -j1 is needed, but this is a small program anyway.
rm -f src/*.{d,o}
make -j1 -C src PROFILE="$SLKCFLAGS"

# no 'make install' target.
mkdir -p $PKG/usr/bin
install -s -m0755 bin/* $PKG/usr/bin

# 20250114 bkw: let the file(1) command recognized SAVEd programs. LISTed
# ones would be a lot more difficult (they're text files and look very
# similar to BASIC).
mkdir -p $PKG/etc/file/magic
cat $CWD/$PRGNAM.magic > $PKG/etc/file/magic/$PRGNAM

# don't need to install build docs.
rm -f doc/BUILD

# no man pages. neither binary takes any flags, so I don't see much point
# in creating them.

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a doc/* samples $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# 20250114 bkw: doinst.sh and douninst.sh are identical, this is not an error.
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/doinst.sh > $PKG/install/douninst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE