1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright 2008, 2009, 2010, 2011, 2012 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 | PKGNAM=gdb |
---|
25 | VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} |
---|
26 | BUILD=${BUILD:-1} |
---|
27 | |
---|
28 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
29 | |
---|
30 | # Automatically determine the architecture we're building on: |
---|
31 | if [ -z "$ARCH" ]; then |
---|
32 | case "$( uname -m )" in |
---|
33 | i?86) export ARCH=i486 ;; |
---|
34 | arm*) export ARCH=arm ;; |
---|
35 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
36 | *) export ARCH=$( uname -m ) ;; |
---|
37 | esac |
---|
38 | fi |
---|
39 | |
---|
40 | if [ "$ARCH" = "x86_64" ]; then |
---|
41 | LIBDIRSUFFIX="64" |
---|
42 | else |
---|
43 | LIBDIRSUFFIX="" |
---|
44 | fi |
---|
45 | |
---|
46 | CWD=$(pwd) |
---|
47 | TMP=${TMP:-/tmp} |
---|
48 | PKG=$TMP/package-gdb |
---|
49 | |
---|
50 | rm -rf $PKG |
---|
51 | mkdir -p $TMP $PKG |
---|
52 | |
---|
53 | cd $TMP |
---|
54 | rm -rf gdb-$VERSION |
---|
55 | tar xvf $CWD/gdb-$VERSION.tar.?z* || exit 1 |
---|
56 | cd gdb-$VERSION || exit 1 |
---|
57 | chown -R root:root . |
---|
58 | find . \ |
---|
59 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
60 | -exec chmod 755 {} \; -o \ |
---|
61 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
62 | -exec chmod 644 {} \; |
---|
63 | |
---|
64 | ./configure \ |
---|
65 | --prefix=/usr \ |
---|
66 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
67 | --mandir=/usr/man \ |
---|
68 | --infodir=/usr/info \ |
---|
69 | --with-python \ |
---|
70 | --build=$ARCH-slackware-linux |
---|
71 | |
---|
72 | #( cd readline ; make ) |
---|
73 | |
---|
74 | make $NUMJOBS || make || exit 1 |
---|
75 | make install DESTDIR=$PKG || exit 1 |
---|
76 | |
---|
77 | # None of this stuff has ever been included in this package: |
---|
78 | rm -f $PKG/usr/lib${LIBDIRSUFFIX}/{libbfd*,libiberty*,libopcodes*} |
---|
79 | #rmdir $PKG/usr/lib${LIBDIRSUFFIX} 2> /dev/null |
---|
80 | rm -f $PKG/usr/info/{annotate*,bfd*,configure*,standards*} |
---|
81 | rm -rf $PKG/usr/include |
---|
82 | |
---|
83 | # Use the -tui option if you want this. |
---|
84 | # Including a whole extra copy of the gdb binary is obnoxious: |
---|
85 | rm -f $PKG/usr/bin/gdbtui $PKG/usr/man/man1/gdbtui.1* |
---|
86 | |
---|
87 | mkdir -p $PKG/usr/doc/gdb-$VERSION/gdb |
---|
88 | cp -a COPYING* README $PKG/usr/doc/gdb-$VERSION |
---|
89 | cd gdb |
---|
90 | cp -a NEWS README $PKG/usr/doc/gdb-$VERSION/gdb |
---|
91 | cp -a gdbserver/README $PKG/usr/doc/gdb-$VERSION/README.gdbserver |
---|
92 | find $PKG/usr/doc/gdb-$VERSION -type f -exec chmod 644 {} \; |
---|
93 | |
---|
94 | # Strip binaries: |
---|
95 | find $PKG | xargs file | grep -e "executable" -e "shared object" \ |
---|
96 | | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
97 | |
---|
98 | # Compress and link manpages, if any: |
---|
99 | if [ -d $PKG/usr/man ]; then |
---|
100 | ( cd $PKG/usr/man |
---|
101 | for manpagedir in $(find . -type d -name "man*") ; do |
---|
102 | ( cd $manpagedir |
---|
103 | for eachpage in $( find . -type l -maxdepth 1) ; do |
---|
104 | ln -s $( readlink $eachpage ).gz $eachpage.gz |
---|
105 | rm $eachpage |
---|
106 | done |
---|
107 | gzip -9 *.? |
---|
108 | ) |
---|
109 | done |
---|
110 | ) |
---|
111 | fi |
---|
112 | |
---|
113 | # Compress info files, if any: |
---|
114 | if [ -d $PKG/usr/info ]; then |
---|
115 | ( cd $PKG/usr/info |
---|
116 | rm -f dir |
---|
117 | gzip -9 * |
---|
118 | ) |
---|
119 | fi |
---|
120 | |
---|
121 | mkdir -p $PKG/install |
---|
122 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
123 | |
---|
124 | # Build the package: |
---|
125 | cd $PKG |
---|
126 | /sbin/makepkg -l y -c n $TMP/gdb-$VERSION-$ARCH-$BUILD.txz |
---|
127 | |
---|