1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright 2008, 2009, 2010, 2011, 2012, 2015 Patrick J. Volkerding, Sebeka, MN, USA |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | # Redistribution and use of this script, with or without modification, is |
---|
7 | # permitted provided that the following conditions are met: |
---|
8 | # |
---|
9 | # 1. Redistributions of this script must retain the above copyright |
---|
10 | # notice, this list of conditions and the following disclaimer. |
---|
11 | # |
---|
12 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
13 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
14 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
15 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
16 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
17 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
18 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
19 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
20 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
21 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
22 | |
---|
23 | |
---|
24 | VERSION=${VERSION:-$(echo subversion-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
25 | BUILD=${BUILD:-1} |
---|
26 | |
---|
27 | # Automatically determine the architecture we're building on: |
---|
28 | if [ -z "$ARCH" ]; then |
---|
29 | case "$( uname -m )" in |
---|
30 | i?86) export ARCH=i586 ;; |
---|
31 | arm*) export ARCH=arm ;; |
---|
32 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
33 | *) export ARCH=$( uname -m ) ;; |
---|
34 | esac |
---|
35 | fi |
---|
36 | |
---|
37 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
38 | |
---|
39 | if [ "$ARCH" = "i586" ]; then |
---|
40 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
41 | LIBDIRSUFFIX="" |
---|
42 | elif [ "$ARCH" = "s390" ]; then |
---|
43 | SLKCFLAGS="-O2" |
---|
44 | LIBDIRSUFFIX="" |
---|
45 | elif [ "$ARCH" = "x86_64" ]; then |
---|
46 | SLKCFLAGS="-O2 -fPIC" |
---|
47 | LIBDIRSUFFIX="64" |
---|
48 | else |
---|
49 | SLKCFLAGS="-O2" |
---|
50 | LIBDIRSUFFIX="" |
---|
51 | fi |
---|
52 | |
---|
53 | CWD=$(pwd) |
---|
54 | TMP=${TMP:-/tmp} |
---|
55 | PKG=$TMP/package-subversion |
---|
56 | |
---|
57 | rm -rf $PKG |
---|
58 | mkdir -p $TMP $PKG |
---|
59 | |
---|
60 | cd $TMP |
---|
61 | rm -rf subversion-$VERSION |
---|
62 | tar xvf $CWD/subversion-$VERSION.tar.?z* || exit 1 |
---|
63 | cd subversion-$VERSION || exit 1 |
---|
64 | |
---|
65 | chown -R root:root . |
---|
66 | find . \ |
---|
67 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
68 | -exec chmod 755 {} \; -o \ |
---|
69 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
70 | -exec chmod 644 {} \; |
---|
71 | |
---|
72 | # --with-apache-libexecdir=/usr/lib${LIBDIRSUFFIX}/httpd/modules \ |
---|
73 | |
---|
74 | CFLAGS="$SLKCFLAGS" \ |
---|
75 | ./configure \ |
---|
76 | --prefix=/usr \ |
---|
77 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
78 | --mandir=/usr/man \ |
---|
79 | --docdir=/usr/doc/subversion-$VERSION \ |
---|
80 | --enable-shared \ |
---|
81 | --disable-static \ |
---|
82 | --with-apr=/usr \ |
---|
83 | --with-apr-util=/usr \ |
---|
84 | --with-apxs \ |
---|
85 | --with-zlib=/usr \ |
---|
86 | --with-pic \ |
---|
87 | --build=$ARCH-slackware-linux |
---|
88 | |
---|
89 | make $NUMJOBS || make || exit 1 |
---|
90 | make install DESTDIR=$PKG || exit 1 |
---|
91 | make install-tools DESTDIR=$PKG || exit 1 |
---|
92 | make install-docs DESTDIR=$PKG || exit 1 |
---|
93 | |
---|
94 | # Install python bindings |
---|
95 | make swig-py |
---|
96 | make install-swig-py DESTDIR=$PKG |
---|
97 | PYTHON_VER=$(python -c 'import sys; print "%d.%d" % sys.version_info[:2]') |
---|
98 | mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/python${PYTHON_VER}/site-packages |
---|
99 | mv $PKG/usr/lib${LIBDIRSUFFIX}/svn-python/* \ |
---|
100 | $PKG/usr/lib${LIBDIRSUFFIX}/python${PYTHON_VER}/site-packages |
---|
101 | rmdir $PKG/usr/lib${LIBDIRSUFFIX}/svn-python |
---|
102 | |
---|
103 | # Perl bindings |
---|
104 | export PKG |
---|
105 | #make swig-pl-lib |
---|
106 | #make install-swig-pl-lib DESTDIR=$PKG |
---|
107 | #( cd subversion/bindings/swig/perl/native |
---|
108 | # perl Makefile.PL |
---|
109 | # make install_vendor DESTDIR=$PKG |
---|
110 | #) |
---|
111 | #eval $(perl '-V:archlib') |
---|
112 | #mv $PKG/$archlib/perllocal.pod $PKG/$archlib/subversion.pod |
---|
113 | |
---|
114 | # Ruby bindings |
---|
115 | #make swig-rb |
---|
116 | #make install-swig-rb DESTDIR=$PKG |
---|
117 | |
---|
118 | find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
119 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
120 | |
---|
121 | rm -rf $PKG/usr/info |
---|
122 | # Something doesn't honor --mandir |
---|
123 | #mv $PKG/usr/share/man/man3 $PKG/usr/man |
---|
124 | gzip -9 $PKG/usr/man/man?/* |
---|
125 | #rmdir $PKG/usr/share/man |
---|
126 | |
---|
127 | # What is this junk for? Since I don't know, I'll erase it. :-) |
---|
128 | rm -rf $PKG/usr/build |
---|
129 | |
---|
130 | mkdir -p $PKG/usr/doc/subversion-$VERSION |
---|
131 | cp -a \ |
---|
132 | BUGS COMMITTERS INSTALL README doc \ |
---|
133 | $PKG/usr/doc/subversion-$VERSION |
---|
134 | # too big && useless for most || if you think not, can be found in the source tarball |
---|
135 | rm -rf $PKG/usr/doc/subversion-$VERSION/doc/tools |
---|
136 | # Add the HTML svn book: |
---|
137 | ( cd $PKG/usr/doc/subversion-$VERSION |
---|
138 | tar xf $CWD/svn-book-html.tar.bz2 |
---|
139 | mv svn-book-html book |
---|
140 | cd book |
---|
141 | chown -R root:root . |
---|
142 | find . -type d -exec chmod 0755 {} \; |
---|
143 | find . -type f -exec chmod 0644 {} \; |
---|
144 | find . -perm 2755 -exec chmod 0755 {} \; |
---|
145 | find . \ |
---|
146 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
147 | -exec chmod 755 {} \; -o \ |
---|
148 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
149 | -exec chmod 644 {} \; |
---|
150 | ) |
---|
151 | |
---|
152 | # If there's a CHANGES file, installing at least part of the recent history |
---|
153 | # is useful, but don't let it get totally out of control: |
---|
154 | if [ -r CHANGES ]; then |
---|
155 | DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) |
---|
156 | cat CHANGES | head -n 1000 > $DOCSDIR/CHANGES |
---|
157 | touch -r CHANGES $DOCSDIR/CHANGES |
---|
158 | fi |
---|
159 | |
---|
160 | # This removes our DESTDIR from the packlist filenames, to keep perl's |
---|
161 | # internal inventories consistent and correct. |
---|
162 | find $PKG -name .packlist | while read plist ; do |
---|
163 | sed -e "s%$PKG%%g" \ |
---|
164 | -e "s%/share/man%/man%g" \ |
---|
165 | -re "s%\.([1-9]n?|3pm)$%&.gz%g # extend man filenames for .gz" \ |
---|
166 | ${plist} > ${plist}.new |
---|
167 | mv -f ${plist}.new ${plist} |
---|
168 | done |
---|
169 | |
---|
170 | mkdir -p $PKG/install |
---|
171 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
172 | |
---|
173 | cd $PKG |
---|
174 | /sbin/makepkg -l y -c n $TMP/subversion-$VERSION-$ARCH-$BUILD.txz |
---|
175 | |
---|