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
|
#!/bin/bash
# $Id: nx.SlackBuild,v 1.8 2009/01/27 20:22:47 root Exp root $
# Copyright (c) 2008, 2009 Eric Hameleers, Eindhoven, The Netherlands
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS 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.
# 3.4.0-1: 23/sep/2010 by ponce <matteo.bernardini@gmail.com>
# * 3.4.0 updates and adaptations for slackbuilds.org
# 3.4.0-2: 21/feb/2011 by ponce <matteo.bernardini@gmail.com>
# * updates and silent default config
# 3.5.0-1: 04/nov/2011 by ponce <matteo.bernardini@gmail.com>
# * updates
# 3.5.0-2: 05/jun/2012 by ponce <matteo.bernardini@gmail.com>
# * updates
PRGNAM=nx
VERSION=${VERSION:-3.5.0}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
SOURCE[0]="$CWD/nxproxy-${VERSION}-1.tar.gz"
SOURCE[1]="$CWD/nxcomp-${VERSION}-2.tar.gz"
SOURCE[2]="$CWD/nxcompext-${VERSION}-1.tar.gz"
SOURCE[3]="$CWD/nxssh-${VERSION}-2.tar.gz"
SOURCE[4]="$CWD/nx-X11-${VERSION}-2.tar.gz"
SOURCE[5]="$CWD/nxwin-${VERSION}-4.tar.gz"
SOURCE[6]="$CWD/nxauth-${VERSION}-1.tar.gz"
SOURCE[7]="$CWD/nxagent-${VERSION}-9.tar.gz"
SOURCE[8]="$CWD/nxesd-${VERSION}-2.tar.gz"
SOURCE[9]="$CWD/nxcompshad-${VERSION}-2.tar.gz"
SOURCE[10]="$CWD/nxscripts-${VERSION}-1.tar.gz"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -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 $TMP/$PRGNAM-$VERSION $PKG
mkdir -p $TMP/$PRGNAM-$VERSION $PKG $OUTPUT
cd $TMP/$PRGNAM-$VERSION
for (( i = 0; i < ${#SOURCE[*]}; i++ )) ; do tar xvf ${SOURCE[$i]} ; done
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
export CXXFLAGS="$SLKCFLAGS"
export CFLAGS="$SLKCFLAGS"
cat >> nx-X11/config/cf/host.def << EOF
#ifdef i386Architecture
#undef DefaultGcc2i386Opt
#define DefaultGcc2i386Opt $SLKCFLAGS -fno-strict-aliasing
#endif
#ifdef MipsArchitecture
#undef DefaultGcc2MipsOpt
#define DefaultGcc2MipsOpt $SLKCFLAGS -fno-strict-aliasing
#endif
#ifdef s390xArchitecture
#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags $SLKCFLAGS -fno-strict-aliasing
#endif
#ifdef AMD64Architecture
#undef DefaultGcc2AMD64Opt
#define DefaultGcc2AMD64Opt $SLKCFLAGS -fno-strict-aliasing
#endif
EOF
sed -i -e "s|CXXFLAGS=.-O.*|CXXFLAGS=\"$CXXFLAGS\"|" */configure
sed -i -e "s|CPPFLAGS=.-O.*|CPPFLAGS=\"$CXXFLAGS\"|" */configure
sed -i -e "s|\"-O3\"|\"$CXXFLAGS\"|" */configure
sed -i -e "s|\"-g -O3\"|\"$CXXFLAGS\"|" */configure
# Build Compression Library and Proxy
for i in nxcomp nxproxy nxcompshad; do
cd $i
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--sysconfdir=/etc \
--build=$ARCH-slackware-linux
make
cd ..
done
# Build X11 Support Libraries and Agents
cd nx-X11 ; make World ; cd ..
# Build Extended Compression Library
cd nxcompext
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--sysconfdir=/etc \
--build=$ARCH-slackware-linux
make
cd ..
# Build nxssh
cd nxssh
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--sysconfdir=/etc \
--without-zlib-version-check \
--build=$ARCH-slackware-linux
make
cd ..
# Build nxesd
cd nxesd
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--sysconfdir=/etc \
--build=$ARCH-slackware-linux
# link to system audiofile libs
sed -i "s/AUDIOFILE_LIBS\ =.*/AUDIOFILE_LIBS = -L\/usr\/lib${LIBDIRSUFFIX} -laudiofile -lm/" Makefile
make
cd ..
# Install all the needed stuff to the package dir
mkdir -p $PKG/usr/bin
cat <<EOT > $PKG/usr/bin/nxagent
#!/bin/sh
NXCOMMAND=\$(basename \$0)
export LD_LIBRARY_PATH=/usr/lib${LIBDIRSUFFIX}/NX/lib:\$LD_LIBRARY_PATH
exec /usr/lib${LIBDIRSUFFIX}/NX/\$NXCOMMAND \${1+"\$@"}
EOT
chmod 0755 $PKG/usr/bin/nxagent
ln -snf nxagent $PKG/usr/bin/nxproxy
ln -snf nxagent $PKG/usr/bin/nxssh
ln -snf nxagent $PKG/usr/bin/nxesd
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/NX/lib
cp -a nx-X11/lib/X11/libX11.so.* \
nx-X11/lib/Xext/libXext.so.* \
nx-X11/lib/Xrender/libXrender.so.* \
$PKG/usr/lib${LIBDIRSUFFIX}/NX/lib
install -m 0755 nx-X11/programs/Xserver/nxagent \
$PKG/usr/lib${LIBDIRSUFFIX}/NX
cp -a nxcomp/libXcomp.so.* $PKG/usr/lib${LIBDIRSUFFIX}/NX/lib
cp -a nxcompext/libXcompext.so.* $PKG/usr/lib${LIBDIRSUFFIX}/NX/lib
cp -a nxcompshad/libXcompshad.so.* $PKG/usr/lib${LIBDIRSUFFIX}/NX/lib
cp -a nxssh/nxssh $PKG/usr/lib${LIBDIRSUFFIX}/NX
cp -a nxesd/nxesd $PKG/usr/lib${LIBDIRSUFFIX}/NX
install -m 0755 nxproxy/nxproxy $PKG/usr/lib${LIBDIRSUFFIX}/NX
# Add documentation:
mkdir -p \
$PKG/usr/doc/$PRGNAM-$VERSION/{nx-X11,nxcomp,nxcompext,nxesd,nxproxy,nxssh}
cd nx-X11
cp -a \
BUILD CHANGELOG* COPYING ChangeLog.X.org LABEL LICENSE README* RELNOTES \
$PKG/usr/doc/$PRGNAM-$VERSION/nx-X11
cd ../nxcomp
cp -a \
COPYING LICENSE README* VERSION \
$PKG/usr/doc/$PRGNAM-$VERSION/nxcomp
cd ../nxcompext
cp -a \
CHANGELOG COPYING LICENSE README* VERSION \
$PKG/usr/doc/$PRGNAM-$VERSION/nxcompext
cd ../nxesd
cp -a \
AUTHORS CHANGELOG COPYING COPYRIGHT ChangeLog.ESD.original \
LICENSE MAINTAINERS NEWS README TIPS TODO \
$PKG/usr/doc/$PRGNAM-$VERSION/nxesd
cd ../nxproxy
cp -a \
CHANGELOG COPYING LICENSE README* VERSION \
$PKG/usr/doc/$PRGNAM-$VERSION/nxproxy
cd ../nxssh
cp -a \
CHANGELOG* CREDITS ChangeLog.SSH.orginal \
LICENCE OVERVIEW README* RFC.nroff TODO WARNING.RNG \
$PKG/usr/doc/$PRGNAM-$VERSION/nxssh
cd ..
cp -a nxscripts $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc -type f -exec chmod 644 {} \;
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
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}
|