aboutsummaryrefslogtreecommitdiff
path: root/development/cmake-202x/cmake-202x.SlackBuild
blob: c2dcced3e1c12c407440a508aaad8fa97a825c54 (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
#!/bin/sh

############################################################
# NOTE: Remove this from the repo when 15.0 ships!         #
# Also remove cmake-202x from REQUIRES in all .info files! #
############################################################

# Slackware build script for cmake-202x

# Written by B. Watson (yalhcru@gmail.com)

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

# This build exists because the cmake in Slackware 14.2 is too old,
# and can't be upgraded. This installs cmake under /opt, where it
# won't conflict with anything. README explains how to use it in your
# SlackBuild.

# cmake.manpages.tar.lz comes from Slackware, courtesy of Pat V. Since
# it's from -current (therefore subject to change), I mirrored the
# version I'm using on slackware.uk.

# 20201108 bkw: updated for 3.18.4, put version number in manpages URL.

PRGNAM=cmake-202x
SRCNAM=cmake
VERSION=${VERSION:-3.18.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
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 $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$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 {} \+

PREFIX=${PREFIX:-/opt/$PRGNAM}
PKGPREFIX=$PKG/$PREFIX

# The --system-* and --no-system-* stuff is intended to use system
# versions of libraries that ship with core Slackware, and bundled
# (non-system) libs for everything that isn't in core, *even* if
# it's available on SBo. This will prevent SBo upgrades from randomly
# breaking things.

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./bootstrap \
  --system-curl \
  --system-expat \
  --no-system-jsoncpp \
  --system-zlib \
  --system-bzip2 \
  --system-liblzma \
  --no-system-nghttp2 \
  --no-system-zstd \
  --system-libarchive \
  --no-system-librhash \
  --no-system-libuv \
  --prefix=$PREFIX

make
make install/strip DESTDIR=$PKG

# To avoid a dependency on Sphinx (which has *26 dependencies* of its own),
# use Pat's prebuilt man pages.
MAN=$CWD/$SRCNAM.manpages.tar.lz
MANV=$CWD/$SRCNAM.manpages.$VERSION.tar.lz
[ -e "$MANV" ] && MAN="$MANV"

tar xvf $MAN
mv usr/man $PKGPREFIX/man
gzip -9 $PKGPREFIX/man/man?/*.?

# Nothing in the doc dir but licenses. Move it to where users expect
# to find it.
mkdir -p $PKG/usr/doc
mv $PKGPREFIX/doc/$SRCNAM-* $PKG/usr/doc/$PRGNAM-$VERSION
rm -rf $PKGPREFIX/doc

cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README_SBo.txt > $PKG/usr/doc/$PRGNAM-$VERSION/README_SBo.txt

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:-tgz}