summaryrefslogtreecommitdiffstats
path: root/network/mosaic-ck/mosaic-ck.SlackBuild
blob: 556e22311933123853a84593fd4ab9e8a9c19996 (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
#!/bin/bash

# Slackware build script for mosaic-ck

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

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

# 20230108 bkw: BUILD=2, fix doinst.sh.
# 20211207 bkw: update for 2.7ck13, which contains build fixes
# for recent glibc (e.g. the one in Slackware -current). Also
# add new-style icons.

# 20161028 bkw: Re-add to SBo, with fix for Slack 14.2's libpng-1.6.
# If you're wondering why I stick with 2.7ck9 when 2.7ck11 has been
# out for a while, it's because none of the changes in ck10 or ck11
# affect the Linux port (only OSX), and because ck11 doesn't build
# (and I already went to the trouble of fixing the ck9 build).

# 20140907 bkw: move the source to my server, since the original
# site isn't wget-friendly. Original URL was:
# http://www.floodgap.com/retrotech/machten/mosaic/mosaic27ck9.tar.gz

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

PRGNAM=mosaic-ck
VERSION=${VERSION:-2.7ck13}
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"
  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

TARBALL="mosaic${VERSION//./}.tar.gz"

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/$TARBALL
cd $PRGNAM
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 {} \+

# I don't know who thought it was a good idea to link with /usr/lib/libjpeg.a
# and /usr/lib/libpng.a instead of just saying -ljpeg -lpng.
# Use our CFLAGS too.
sed -i \
  -e '/^pnglibs/s,.*,pnglibs = -lpng -lz -lm,' \
  -e '/^jpeglibs/s,.*,jpeglibs = -ljpeg,' \
  -e "/^CFLAGS/s,-g,$SLKCFLAGS," \
  makefiles/Makefile.linux

# Fix for libpng 1.5 and up, taken from https://github.com/yotann/ncsa-mosaic
# and reworked for mosaic-ck.
patch -p1 < $CWD/mosaic_png_fix.diff

# there's a configure script, but it's just cruft.
make -j1 linux

# no 'make install' target, it's fairly self-contained anyway.
# binary gets installed as mosaic-ck, doinst.sh will symlink it to
# Mosaic if there's not already a Mosaic in /usr/bin.
mkdir -p $PKG/usr/bin
install -m0755 -oroot -groot -s src/Mosaic $PKG/usr/bin/$PRGNAM

# Maybe this could be a .new config file? None of Pat's packages that
# have app-defaults install them as .new, so I won't either.
mkdir -p $PKG/etc/X11/app-defaults
install -m0644 app-defaults.color $PKG/etc/X11/app-defaults/Mosaic

# .desktop file is a modified copy of
# https://github.com/wtachi/ncsa-mosaic/blob/master/desktop/Mosaic.desktop
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# Original mosaic uses an icon that looks like icon.1.xpm. Go ahead
# and use it, since there's no chance of conflicting with the original
# mosaic on modern systems.
for px in 16 32 48 64; do
  size=${px}x${px}
  dir=$PKG/usr/share/icons/hicolor/$size/apps
  mkdir -p $dir
  convert -resize $size src/pixmaps/icon.1.xpm $dir/$PRGNAM.png
done

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

# man page written for this build. kind of amazed that the source doesn't
# come with a man page.
mkdir -p $PKG/usr/man/man1
sed "s,@VERSION@,$VERSION,g" $CWD/$PRGNAM.1 | \
   gzip -9c - > $PKG/usr/man/man1/$PRGNAM.1.gz

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/sample_dotfiles
cp -a AATODO CHANGES COPYRIGHT FEATURES README* $PKG/usr/doc/$PRGNAM-$VERSION
cp -a mosaic-* $PKG/usr/doc/$PRGNAM-$VERSION/sample_dotfiles
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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