/
lyx.SlackBuild
135 lines (117 loc) · 3.81 KB
/
lyx.SlackBuild
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
#!/bin/sh
#
# Slackware build script for LyX (http://www.lyx.org/)
#
# Copyright 2008-2015 Corrado Franco (http://conraid.net)
# 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.
# Exit on most errors
set -eu
# Set variables:
CWD=$(pwd)
PRGNAME=${PRGNAME:-lyx}
PKGNAME=$(echo $PRGNAME | tr A-Z a-z)
VERSION=${VERSION:-2.1.3}
BUILD=${BUILD:-1}
ARCH=${ARCH:=""} # Set ARCH or leave blank to determine it automatically
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=$TMP/package-$PRGNAME
DOCS="$PKG/usr/doc/$PRGNAME-$VERSION"
# Insert document files in this variable
DOCFILES="ABOUT-NLS ANNOUNCE COPYING INSTALL* NEWS README* UPGRADING"
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
# Set compiling FLAGS
case "$ARCH" in
i486)
SLKCFLAGS="-O2 -march=i486 -mtune=i686"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
i686)
SLKCFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
x86_64)
SLKCFLAGS="-O2 -fPIC -pipe -fomit-frame-pointer"; CHOST="x86_64"
SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
;;
*)
SLKCFLAGS="-O2"; CHOST=$ARCH
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
esac
# Extract source and prepare:
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PRGNAME-$VERSION
tar xvf $CWD/$PRGNAME-$VERSION.tar.xz
cd $PRGNAME-$VERSION
# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Configure
LDFLAGS="$SLKLDFLAGS" \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
--with-x \
--without-included-boost \
--host=$CHOST-slackware-linux \
--build=$CHOST-slackware-linux
# Build and install:
make
make DESTDIR=$PKG install-strip
# Compress and link manpages, if any:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
)
fi
# Add a documentation directory:
mkdir -p ${DOCS}
cp -a $DOCFILES $DOCS || true
# Add a slackbuild script:
install -Dm644 $CWD/$PKGNAME.SlackBuild $DOCS/$PKGNAME.SlackBuild
# Add slack-desc
install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
# Add a doinst.sh
install -Dm644 $CWD/doinst.sh $PKG/install/doinst.sh
# Add a desktop file
install -Dm644 lib/$PKGNAME.desktop $PKG/usr/share/applications/$PKGNAME.desktop
# Add an icon
install -Dm644 lib/images/$PKGNAME.png $PKG/usr/share/pixmaps/$PKGNAME.png
# Create package:
cd $PKG
/sbin/makepkg -l y -c n $CWD/$PRGNAME-$VERSION-$ARCH-${BUILD}${TAG}.txz