aboutsummaryrefslogtreecommitdiff
path: root/patches/subversion/subversion.SlackBuild
blob: 1e6a24cbc34f20f43502f7ce52cb1f9fcd10e9b0 (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
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
#
# got it from ftp://ftp.slackware.com/pub/slackware/slackware-12.0/source/d/subversion/subversion.SlackBuild
# small changes by rhatto at riseup.net
#

# needs a function from simplepkg
function default_version {

  # get version from /etc/slackware-version
  if [ -f "$1/etc/slackware-version" ]; then
    cat $1/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//'
  else
    echo "none"
  fi

}

if [ -s "slack-required" ]; then
  echo Recomended and required packages for building subversion are:
  cat slack-required | sed -e 's/^/\t/'
  if [ "$INTERACT" != "no" ]; then
    echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER.
    read crap
#  else
#    echo Sleeping 3 seconds...
#    sleep 3
  fi
fi

CWD="`pwd`"

if [ -f ~/.slackbuildrc ]; then
  source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
  source /etc/slackbuildrc
fi

# default settings
PACKAGE="subversion"
ARCH=${ARCH:=i486}
VERSION=${VERSION:=1.4.4}
BUILD=${BUILD:=1rha}
SRC_DIR=${SRC:=$CWD}
TMP=${TMP:=/tmp}
REPOS=${REPOS:=$TMP}
DISTRO_VERSION="`default_version`"

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

# -------  error codes for createpkg  --------------
ERROR_WGET=31;      ERROR_MAKE=32;      ERROR_INSTALL=33
ERROR_MD5=34;       ERROR_CONF=35;      ERROR_HELP=36
ERROR_TAR=37;       ERROR_MKPKG=38;     ERROR_GPG=39
ERROR_PATCH=40

RTOOL="wget"
PACKAGE_EXT="bz2"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
URL="http://subversion.tigris.org/downloads/$SRC"

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
  wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET
fi

wget http://svnbook.red-bean.com/nightly/en/svn-book-html.tar.bz2 -O $SRC_DIR/svn-book-html.tar.bz2 || exit $ERROR_WGET
chmod 644 $SRC_DIR/svn-book-html.tar.bz2

TMP=$TMP/$PACKAGE
PKG=$TMP/package-subversion
rm -rf $TMP
mkdir -p $PKG

cd $TMP/$PACKAGE
tar xvf $SRC_DIR/$SRC || exit $ERROR_TAR
cd subversion-$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 {} \;

if [ "$DISTRO_VERSION" == "12.0" ]; then
  APXS="--with-apxs=/usr/sbin/apxs"
fi

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=$LIBDIR \
  --enable-shared \
  --disable-static \
  --with-apr=/usr \
  --with-apr-util=/usr \
  --with-neon=/usr \
  --with-pic \
  --with-ssl \
  --with-zlib \
  --build=$ARCH-slackware-linux $APXS || exit $ERROR_CONF

make -j4 || exit $ERROR_MAKE
make swig-py || exit $ERROR_MAKE
make install DESTDIR=$PKG || exit $ERROR_INSTALL
make install-docs DESTDIR=$PKG || exit $ERROR_INSTALL
make install-swig-py DESTDIR=$PKG || exit $ERROR_INSTALL

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
rm -rf $PKG/usr/info
gzip -9 $PKG/usr/man/man?/*

# What is this junk for?  Since I don't know, I'll erase it.  :-)
rm -rf $PKG/usr/build

cp -a \
  BUGS CHANGES COMMITTERS COPYING HACKING INSTALL README TRANSLATING doc \
  $PKG/usr/doc/subversion-$VERSION
# too big && useless for most || if you think not, can be found in the source tarball
rm -rf $PKG/usr/doc/subversion-$VERSION/doc/tools
# Add the HTML svn book:
( cd $PKG/usr/doc/subversion-$VERSION
  tar xjf $SRC_DIR/svn-book-html.tar.bz2
  mv svn-book-html book
  cd book
  find . -type d -exec chmod 755 {} \;
  find . -type f -exec chmod 644 {} \;
  chown -R root:root .
  find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 -o perm 2755 \) \
  -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;
) 

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi