aboutsummaryrefslogtreecommitdiff
path: root/x11/libs/qt4/qt4.SlackBuild
blob: 2f4641d3a53d5e63000274086d74064ae4de0115 (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
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh

# Slackware build script for Qt 4
# Written by Aleksandar Samardzic <asamardzic@gmail.com>
# Modified by Robby Workman <rworkman@slackbuilds.org>
# Adaptation for slack.sarava.org standard by Rafael Diniz <rafael (at) riseup (dot) net>

PRGNAM=qt4
VERSION=${VERSION:-4.4.3}
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-rd}
SRC_DIR=${SRC_DIR:=$CWD}/$PRGNAM
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PRGNAM
REPOS=${REPOS:=$TMP}

# Dowload source if necessary
SRC="qt-x11-opensource-src-$VERSION.tar.gz"
URL="ftp://ftp.trolltech.com/qt/source/$SRC"


JOBS=${JOBS:-5}

LIBDIR=/usr/lib

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIR=/usr/lib64
fi

set -e

# clean up
rm -rf "$PKG" 2> /dev/null

# create dirs
mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR
mkdir -p "$PKG" || exit $ERROR_MKDIR
mkdir -p "$REPOS" || exit $ERROR_MKDIR

if [ ! -s "$SRC_DIR/$SRC" ]; then
  wget "$URL" -O "$SRC_DIR/$SRC"
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf qt-x11-opensource-src-$VERSION
tar xvf $SRC_DIR/qt-x11-opensource-src-$VERSION.tar.gz
cd qt-x11-opensource-src-$VERSION
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS"
export OPENSOURCE_CXXFLAGS="$SLKCFLAGS"
echo "yes" | ./configure \
  -prefix $LIBDIR/qt-$VERSION \
  -libdir $LIBDIR \
  -nomake examples \
  -nomake demos

make -j $JOBS
make install INSTALL_ROOT=$PKG

( cd $PKG/$LIBDIR ; ln -sf qt-$VERSION qt4 )

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

mkdir -p $PKG/usr/bin
( cd $PKG/usr/bin
  for file in assistant assistant_adp designer linguist lrelease lupdate moc pixeltool qcollectiongenerator qdbus qdbuscpp2xml qdbusviewer qdbusxml2cpp qhelpconverter qhelpgenerator qmake qt3to4 qtconfig rcc uic uic3 xmlpatterns;
  do
    ln -sf $LIBDIR/qt-$VERSION/bin/$file ${file}-qt4 ;
  done
)

# mkdir -p $PKG/$LIBDIR/pkgconfig
# ( cd $PKG/$LIBDIR/pkgconfig
#   for file in Qt3Support.pc QtAssistantClient.pc QtCore.pc \
#     QtDBus.pc QtGui.pc QtNetwork.pc QtOpenGL.pc QtScript.pc \
#     QtSql.pc QtSvg.pc QtTest.pc QtUiTools.pc QtXml.pc ; 
#   do
#     ln -sf $LIBDIR/qt-$VERSION/lib/pkgconfig/$file . ;
#   done
# )

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a GPL_EXCEPTION.TXT GPL_EXCEPTION_ADDENDUM.TXT INSTALL LICENSE.GPL* \
  LICENSE.QPL OPENSOURCE-NOTICE.TXT README changes-$VERSION \
  $PKG/usr/doc/$PRGNAM-$VERSION
( cd $PKG/usr/doc/$PRGNAM-$VERSION ; ln -sf $LIBDIR/qt-$VERSION/doc/html . )

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

mkdir -p $PKG/install

cat << EODESC > "$PKG/install/slack-desc"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

   |-----handy-ruler------------------------------------------------------|
qt4: Qt 4 (Qt4 toolkit)
qt4:
qt4: Qt 4 sets the standard for high-performance, cross-platform
qt4: application development. It includes a C++ class library and
qt4: tools for cross-platform development and internationalization.
qt4:
qt4: Homepage: http://trolltech.com/products/qt/
qt4:
qt4:
qt4:
qt4:
EODESC

cat << EODESC > "$PKG/install/doinst.sh"
#!/bin/sh
# Add /opt/qt4/lib Qt4 library to /etc/ld.so.conf
# or not?

#if [ -z "$(cat /etc/ld.so.conf | grep "/opt/qt4/lib")" ]; then
#   echo "/opt/qt4/lib" >> /etc/ld.so.conf
#fi
EODESC

cd $PKG
/sbin/makepkg -l y -c n $REPOS/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz

# Delete source and build directories if requested
if [ "$CLEANUP" == "yes" ]; then
  rm -rf "$PKG"
fi