summaryrefslogtreecommitdiff
path: root/academic/QtiPlot/QtiPlot.SlackBuild
blob: 77ea874e3d7a14004c24bf5768f49f06b697a3e2 (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
#!/bin/sh

# Slackware build script for QtiPlot
# Written by Petar Petrov, <ppetrov@paju.oulu.fi> and 
# hereby submitted to the public domain

# Based on the QtiPlot package PKGBUILD from Arch Extra.
# Maintainer and packager is Ronald van Haren. Thank you!
# http://www.archlinux.org/packages/extra/i686/qtiplot

# THIS SLACKBUILD IS DISTRIBUTETD IN THE HOPE OF BEING 
# USEFUL BUT WITHOUT ANY WARRANTY. THE AUTHOR IS _NOT_ 
# RESPONSIBLE FOR ANY DAMAGE OR DATA LOSS CAUSED BY IT.

PRGNAM=QtiPlot
VERSION=${VERSION:-0.9.8.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

SRCNAM=$(echo $PRGNAM | tr A-Z a-z)

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

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

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 $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.bz2
cd $TMP/$SRCNAM-$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 {} \;
	
# Build QtiPlot's qwt
cd $TMP/$SRCNAM-$VERSION/3rdparty/qwt
qmake
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make

# Build QtiPlot's qwtplot3d
cd $TMP/$SRCNAM-$VERSION/3rdparty/qwtplot3d
qmake
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make

# Build QTeXEngine
cd $TMP/$SRCNAM-$VERSION/3rdparty
unzip $CWD/QTeXEngine-0.3-opensource.zip
cd QTeXEngine
qmake
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make

# Use the custom build.conf
cd $TMP/$SRCNAM-$VERSION
cp $CWD/build.conf.slack build.conf

# A few path fixes to qtiplot.pro
sed -i "s:/usr/local:/usr/share:" qtiplot/qtiplot.pro
sed -i "s:/share/man:/man:" qtiplot/qtiplot.pro
sed -i "s:/share/doc/qtiplot:/doc/$PRGNAM-$VERSION:" qtiplot/qtiplot.pro

# Point to the right places of qt-assistant-compat, libreoffice 
# (when installed), latex, java and python configuration files.
sed -i "s:<QAssistantClient>:<QtAssistant/qassistantclient.h>:" qtiplot/src/core/ApplicationWindow.cpp
sed -i "s:/usr/bin/soffice:/usr/bin/libreoffice:" qtiplot/src/core/ApplicationWindow.cpp
sed -i "s:/usr/bin/latex:/usr/share/texmf/bin/latex:" qtiplot/src/core/ApplicationWindow.cpp
sed -i "s:/usr/bin/java:/usr/lib${LIBDIRSUFFIX}/java/bin/java:" qtiplot/src/core/ApplicationWindow.cpp
sed -i 's#d_python_config_folder + "#"/usr/share/qtiplot#' qtiplot/src/core/ApplicationWindow.cpp

# Build QtiPlot
cd $TMP/$SRCNAM-$VERSION/qtiplot
qmake qtiplot.pro
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
make
make install INSTALL_ROOT=$PKG
cd -

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Menu item, icon and mime types
mkdir -p $PKG/usr/share/{pixmaps,applications,mime/packages}
cp $CWD/qtiplot.png $PKG/usr/share/pixmaps
cp $CWD/qtiplot.desktop $PKG/usr/share/applications
cp $CWD/qtiplot.xml $PKG/usr/share/mime/packages

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
  README.html gpl_licence.txt qtiplot.css qtiplot_logo.png \
  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/build.conf.slack > $PKG/usr/doc/$PRGNAM-$VERSION/build.conf.slack

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