summaryrefslogtreecommitdiffstats
path: root/network/syncterm/syncterm.SlackBuild
blob: 4f746b256826ab6040dbc2dfe9639d7374994f78 (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash

# Slackware build script for syncterm

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

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

# Issues:
# 1. Figure out why shell: doesn't work on the command line (though
#    it does, with the ^D "quick connect" option, or by adding it to
#    the dialing list).
# 2. How do we use /etc/syncterm.lst? strace shows that syncterm reads it,
#    but entries there don't show up in the dialing list (not even if there's
#    no user list). If I could get the system list to work, I'd include an
#    entry there for a local shell (to work around issue #1). But probably
#    nobody much cares about using this as an xterm or konsole replacement...
# Neither of these issues are going to prevent me from submitting this.

# Note: phigan on #atari tells me they're "almost ready" to release 1.2,
# so this may get updated soon.

# 20240218 bkw: BUILD=2
# - add compile fix for -current.

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

PRGNAM=syncterm
VERSION=${VERSION:-1.1}
BUILD=${BUILD:-2}
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
tar xvf $CWD/$PRGNAM-$VERSION-src.tgz
cd $PRGNAM-$VERSION
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 {} +

# Man page: Fix path to dialing list and a couple typos. The path
# baked into the binary really is /etc/syncterm.lst (not /usr/etc)...
# although I don't see a way to make syncterm actually use the
# system-wide dialing list.
patch -p1 < $CWD/manpage.diff

# 20240218 bkw: fix compilation on -current (or so I am assured). Doesn't
# hurt anything on 15.0. Patch originally from:
# https://raw.github.com/nullman/config/master/common/.nixos/pkgs/syncterm/0002-use-sched-yield-53264f2b.diff
# ...brought to my attention by Joshua E. Roybal via email.
patch -p1 < $CWD/0002-use-sched-yield-53264f2b.diff

# This is a big hassle: -O3 is hardcoded in a makefile... which is
# inside a zip file. To force our flags, we have to extract the zip
# file, mod the makefile, then re-zip it. Using -0 with zip means
# "store" (for speed).
cd 3rdp/dist
unzip -oa cryptlib.zip
rm -f cryptlib.zip
sed -i "s,-O3,$SLKCFLAGS," makefile
zip -0r cryptlib.zip *
cd -

# Rest of the flags:
sed -i "s,-O2,$SLKCFLAGS," src/build/Common.gmake
sed -i "s,-O3,\"$SLKCFLAGS\"," 3rdp/build/GNUmakefile

# Top-level source directory:
cd src/$PRGNAM

# Lots of make options here:
# - RELEASE=1 means binary already stripped, man page already gzipped.
# - WITHOUT_PORTAUDIO=1 to avoid a hidden dependency on portaudio. I
#   see no advantage to using portaudio anyway (SDL audio works fine).
# - INSTALL_DATA: install man page with usual Slackware permissions.
# - SRC_ROOT has to be set because the makefile is dumb...
# - Use -j1 as the compile always fails if -jN where N>1.
make -j1 \
  PREFIX=/usr \
  MANPREFIX=/usr \
  SYSTEM_LIST_DIR=/etc \
  SRC_ROOT="$( realpath .. )" \
  USE_SDL=1 \
  USE_SDL_AUDIO=1 \
  WITHOUT_PORTAUDIO=1 \
  VERBOSE=1 \
  RELEASE=1 \
  DESTDIR=$PKG \
  INSTALL_DATA="install -m 0644" \
  all install

# Compile the terminfo entries. Have to run the binary we just built,
# let's not do it as root.
su nobody -s /bin/sh -c "$PKG/usr/bin/$PRGNAM -T" | \
  tic -o $PKG/usr/share/terminfo -

# The 64x64 icon was installed by 'make install', above.
# Other icons extracted from the Mac .icns file:
# sh extract-icns.sh /tmp/SBo/syncterm-1.1/src/syncterm/SyncTERM.icns
# If you're copying this code for use in your own SlackBuild, please
# don't change the "cat" to "cp -a", below: files copied from $CWD
# might be owned by anybody (not necessarily root), and have wrong
# permissions; using "cat >" takes care of both.
# Also, please don't rewrite this to call icns2png in your script.
# Otherwise you'd have to add libicns to REQUIRES.
for png in $CWD/icons/*.png; do
  px="$( basename $png | cut -d. -f1 )"
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  cat $png > $dir/$PRGNAM.png
done

mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a Install-Mozilla.txt CHANGES LICENCE gpl.txt $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

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