aboutsummaryrefslogtreecommitdiff
path: root/misc/open-simh/open-simh.SlackBuild
blob: 3615df40f9959ede9fc1411ce1b5e234e9e75632 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/bin/bash

# Slackware build script for Open-SimH

# Copyright 2023 Antonio Leal, Porto Salvo, Oeiras, Portugal
# 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=open-simh
SRCNAM=simh
VERSION=${VERSION:-c077c22}
COMMIT=${COMMIT:-c077c22d24bc5feda3a106c53d604923af19e14d}
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"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
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 $SRCNAM-$COMMIT
tar xvf $CWD/$SRCNAM-$COMMIT.tar.gz
cd $SRCNAM-$COMMIT

chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

# make -j1 BIN/vax
# make -j1 BIN/pdp11
make -j1 all

mkdir -p $PKG/opt/$PRGNAM/bin
mv BIN/* $PKG/opt/$PRGNAM/bin

### Symlinks ##
mkdir -p $PKG/usr/bin
( cd $PKG/usr/bin ; rm -rf open-simh-3b2 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/3b2 open-simh-3b2 )
( cd $PKG/usr/bin ; rm -rf open-simh-3b2-400 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/3b2-400 open-simh-3b2-400 )
( cd $PKG/usr/bin ; rm -rf open-simh-3b2-700 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/3b2-700 open-simh-3b2-700 )
( cd $PKG/usr/bin ; rm -rf open-simh-altair )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/altair open-simh-altair )
( cd $PKG/usr/bin ; rm -rf open-simh-altairz80 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/altairz80 open-simh-altairz80 )
( cd $PKG/usr/bin ; rm -rf open-simh-b5500 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/b5500 open-simh-b5500 )
( cd $PKG/usr/bin ; rm -rf open-simh-besm6 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/besm6 open-simh-besm6 )
( cd $PKG/usr/bin ; rm -rf open-simh-cdc1700 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/cdc1700 open-simh-cdc1700 )
( cd $PKG/usr/bin ; rm -rf open-simh-eclipse )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/eclipse open-simh-eclipse )
( cd $PKG/usr/bin ; rm -rf open-simh-gri )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/gri open-simh-gri )
( cd $PKG/usr/bin ; rm -rf open-simh-h316 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/h316 open-simh-h316 )
( cd $PKG/usr/bin ; rm -rf open-simh-hp2100 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/hp2100 open-simh-hp2100 )
( cd $PKG/usr/bin ; rm -rf open-simh-hp3000 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/hp3000 open-simh-hp3000 )
( cd $PKG/usr/bin ; rm -rf open-simh-i1401 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i1401 open-simh-i1401 )
( cd $PKG/usr/bin ; rm -rf open-simh-i1620 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i1620 open-simh-i1620 )
( cd $PKG/usr/bin ; rm -rf open-simh-i650 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i650 open-simh-i650 )
( cd $PKG/usr/bin ; rm -rf open-simh-i701 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i701 open-simh-i701 )
( cd $PKG/usr/bin ; rm -rf open-simh-i7010 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i7010 open-simh-i7010 )
( cd $PKG/usr/bin ; rm -rf open-simh-i704 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i704 open-simh-i704 )
( cd $PKG/usr/bin ; rm -rf open-simh-i7070 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i7070 open-simh-i7070 )
( cd $PKG/usr/bin ; rm -rf open-simh-i7080 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i7080 open-simh-i7080 )
( cd $PKG/usr/bin ; rm -rf open-simh-i7090 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i7090 open-simh-i7090 )
( cd $PKG/usr/bin ; rm -rf open-simh-i7094 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/i7094 open-simh-i7094 )
( cd $PKG/usr/bin ; rm -rf open-simh-ibm1130 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/ibm1130 open-simh-ibm1130 )
( cd $PKG/usr/bin ; rm -rf open-simh-id16 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/id16 open-simh-id16 )
( cd $PKG/usr/bin ; rm -rf open-simh-id32 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/id32 open-simh-id32 )
( cd $PKG/usr/bin ; rm -rf open-simh-imlac )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/imlac open-simh-imlac )
( cd $PKG/usr/bin ; rm -rf open-simh-infoserver100 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/infoserver100 open-simh-infoserver100 )
( cd $PKG/usr/bin ; rm -rf open-simh-infoserver1000 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/infoserver1000 open-simh-infoserver1000 )
( cd $PKG/usr/bin ; rm -rf open-simh-infoserver150vxt )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/infoserver150vxt open-simh-infoserver150vxt )
( cd $PKG/usr/bin ; rm -rf open-simh-intel-mds )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/intel-mds open-simh-intel-mds )
( cd $PKG/usr/bin ; rm -rf open-simh-lgp )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/lgp open-simh-lgp )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax1 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax1 open-simh-microvax1 )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax2 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax2 open-simh-microvax2 )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax2000 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax2000 open-simh-microvax2000 )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax3100 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax3100 open-simh-microvax3100 )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax3100e )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax3100e open-simh-microvax3100e )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax3100m80 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax3100m80 open-simh-microvax3100m80 )
( cd $PKG/usr/bin ; rm -rf open-simh-microvax3900 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/microvax3900 open-simh-microvax3900 )
( cd $PKG/usr/bin ; rm -rf open-simh-nd100 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/nd100 open-simh-nd100 )
( cd $PKG/usr/bin ; rm -rf open-simh-nova )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/nova open-simh-nova )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp1 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp1 open-simh-pdp1 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp10 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp10 open-simh-pdp10 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp10-ka )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp10-ka open-simh-pdp10-ka )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp10-ki )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp10-ki open-simh-pdp10-ki )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp10-kl )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp10-kl open-simh-pdp10-kl )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp10-ks )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp10-ks open-simh-pdp10-ks )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp11 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp11 open-simh-pdp11 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp15 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp15 open-simh-pdp15 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp4 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp4 open-simh-pdp4 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp6 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp6 open-simh-pdp6 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp7 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp7 open-simh-pdp7 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp8 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp8 open-simh-pdp8 )
( cd $PKG/usr/bin ; rm -rf open-simh-pdp9 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/pdp9 open-simh-pdp9 )
( cd $PKG/usr/bin ; rm -rf open-simh-rtvax1000 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/rtvax1000 open-simh-rtvax1000 )
( cd $PKG/usr/bin ; rm -rf open-simh-s3 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/s3 open-simh-s3 )
( cd $PKG/usr/bin ; rm -rf open-simh-scelbi )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/scelbi open-simh-scelbi )
( cd $PKG/usr/bin ; rm -rf open-simh-sds )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/sds open-simh-sds )
( cd $PKG/usr/bin ; rm -rf open-simh-sel32 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/sel32 open-simh-sel32 )
( cd $PKG/usr/bin ; rm -rf open-simh-sigma )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/sigma open-simh-sigma )
( cd $PKG/usr/bin ; rm -rf open-simh-ssem )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/ssem open-simh-ssem )
( cd $PKG/usr/bin ; rm -rf open-simh-swtp6800mp-a )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/swtp6800mp-a open-simh-swtp6800mp-a )
( cd $PKG/usr/bin ; rm -rf open-simh-swtp6800mp-a2 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/swtp6800mp-a2 open-simh-swtp6800mp-a2 )
( cd $PKG/usr/bin ; rm -rf open-simh-tt2500 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/tt2500 open-simh-tt2500 )
( cd $PKG/usr/bin ; rm -rf open-simh-tx-0 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/tx-0 open-simh-tx-0 )
( cd $PKG/usr/bin ; rm -rf open-simh-uc15 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/uc15 open-simh-uc15 )
( cd $PKG/usr/bin ; rm -rf open-simh-vax )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax open-simh-vax )
( cd $PKG/usr/bin ; rm -rf open-simh-vax730 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax730 open-simh-vax730 )
( cd $PKG/usr/bin ; rm -rf open-simh-vax750 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax750 open-simh-vax750 )
( cd $PKG/usr/bin ; rm -rf open-simh-vax780 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax780 open-simh-vax780 )
( cd $PKG/usr/bin ; rm -rf open-simh-vax8200 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax8200 open-simh-vax8200 )
( cd $PKG/usr/bin ; rm -rf open-simh-vax8600 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vax8600 open-simh-vax8600 )
( cd $PKG/usr/bin ; rm -rf open-simh-vaxstation3100m30 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vaxstation3100m30 open-simh-vaxstation3100m30 )
( cd $PKG/usr/bin ; rm -rf open-simh-vaxstation3100m38 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vaxstation3100m38 open-simh-vaxstation3100m38 )
( cd $PKG/usr/bin ; rm -rf open-simh-vaxstation3100m76 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vaxstation3100m76 open-simh-vaxstation3100m76 )
( cd $PKG/usr/bin ; rm -rf open-simh-vaxstation4000m60 )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vaxstation4000m60 open-simh-vaxstation4000m60 )
( cd $PKG/usr/bin ; rm -rf open-simh-vaxstation4000vlc )
( cd $PKG/usr/bin ; ln -sf ../../opt/open-simh/bin/vaxstation4000vlc open-simh-vaxstation4000vlc )


rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

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

( cd $PKG/opt/$PRGNAM ; rm -rf doc )
( cd $PKG/opt/$PRGNAM ; ln -sf ../../usr/doc/$PRGNAM-$VERSION doc )

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