aboutsummaryrefslogtreecommitdiff
path: root/development/vasm/vasm.SlackBuild
blob: 7341bf85449ea35205b1ff64981cfc11992090a5 (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
#!/bin/bash

# Slackware build script for vasm

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

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

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

PRGNAM=vasm
VERSION=${VERSION:-1.9a}
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

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
# create our own versioned top-level dir.
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/${PRGNAM}${VERSION/./_}.tar.gz
cd $PRGNAM
chown -R root:root .
# permissions are awful, don't use template here.
find . -type d -exec chmod 755 {} \+
find . -type f -exec chmod 644 {} \+

sed -i "/^COPTS/s,-O2,$SLKCFLAGS," Makefile

runmake() {
  local    cpu="$( echo "$1" | cut -d- -f1 )"
  local syntax="$( echo "$1" | cut -d- -f2 )"
  rm -rf obj/*
  make CPU=$cpu SYNTAX=$syntax
  install -s -m0755 ${PRGNAM}${cpu}* $PKG/usr/bin
  rm -f ${PRGNAM}${cpu}*
}

# qnice looks to be a toy/test architecture (only 22 opcodes), and
# it's never explained in the docs. leave it out.

# every CPU gets std syntax:
CPUS="6502 6800 6809 arm c16x jagrisc m68k \
      pdp11 ppc tr3200 vidcore x86 z80"

# only a few CPUs get extra syntax modules:
EXTRAS="m68k-mot ppc-mot 6502-madmac jagrisc-madmac \
        6502-oldstyle 6800-oldstyle 6809-oldstyle z80-oldstyle"

mkdir -p $PKG/usr/bin
for cpu in $CPUS; do
  runmake $cpu-std
done
for cpusyn in $EXTRAS; do
  runmake $cpusyn
done

install -s -m0755 vobjdump $PKG/usr/bin

make doc/vasm.pdf

# This would require texi2html... but it fails with the texi2html
# we have on SBo:
#make doc/vasm.html

# This works, but doesn't create an index or TOC. Without
# --no-split, the result is kinda hard to use.
( cd doc && texi2any --no-split --html vasm.texi )

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a doc/vasm.pdf $PKGDOC
cp -a doc/index.html $PKGDOC/vasm.html
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