1 | #!/bin/sh |
---|
2 | #DEP:openssl |
---|
3 | # Set initial variables: |
---|
4 | CWD=`pwd` |
---|
5 | if [ "$TMP" = "" ]; then |
---|
6 | TMP=/tmp |
---|
7 | fi |
---|
8 | PKG=$TMP/package-bind |
---|
9 | rm -rf $PKG |
---|
10 | |
---|
11 | VERSION=9.5.1-P2 |
---|
12 | PVER=9.5.1_P2 |
---|
13 | ARCH=${ARCH:-i486} |
---|
14 | BUILD=${BUILD:-1} |
---|
15 | |
---|
16 | # Edit these library versions with each release: |
---|
17 | #LIBBINDVER=0.0.5 |
---|
18 | #LIBDNSVER=20.0.2 |
---|
19 | #LIBISCVER=9.1.5 |
---|
20 | #LIBISCCCVER=0.2.1 |
---|
21 | #LIBISCCFGVER=1.0.5 |
---|
22 | #LIBLWRESVER=1.2.2 |
---|
23 | |
---|
24 | # Determine major numbers: |
---|
25 | #LIBBINDMAJOR=`echo $LIBBINDVER | cut -f 1 -d .` |
---|
26 | #LIBDNSMAJOR=`echo $LIBDNSVER | cut -f 1 -d .` |
---|
27 | #LIBISCMAJOR=`echo $LIBISCVER | cut -f 1 -d .` |
---|
28 | #LIBISCCCMAJOR=`echo $LIBISCCCVER | cut -f 1 -d .` |
---|
29 | #LIBISCCFGMAJOR=`echo $LIBISCCFGVER | cut -f 1 -d .` |
---|
30 | #LIBLWRESMAJOR=`echo $LIBLWRESVER | cut -f 1 -d .` |
---|
31 | |
---|
32 | if [ "$ARCH" = "i386" ]; then |
---|
33 | SLKCFLAGS="-O2 -march=i386 -mcpu=i686" |
---|
34 | elif [ "$ARCH" = "i486" ]; then |
---|
35 | SLKCFLAGS="-O2 -march=i486 -mcpu=i686" |
---|
36 | elif [ "$ARCH" = "s390" ]; then |
---|
37 | SLKCFLAGS="-O2" |
---|
38 | elif [ "$ARCH" = "x86_64" ]; then |
---|
39 | SLKCFLAGS="-O2" |
---|
40 | fi |
---|
41 | |
---|
42 | if [ ! -d $TMP ]; then |
---|
43 | mkdir -p $TMP # location to build the source |
---|
44 | fi |
---|
45 | rm -rf $PKG |
---|
46 | mkdir -p $PKG |
---|
47 | |
---|
48 | # Explode the package framework: |
---|
49 | cd $PKG |
---|
50 | explodepkg $CWD/_bind.tar.gz |
---|
51 | |
---|
52 | cd $TMP |
---|
53 | rm -rf bind-$VERSION |
---|
54 | tar xzvf $CWD/bind-$VERSION.tar.gz || exit 1 |
---|
55 | cd bind-$VERSION |
---|
56 | |
---|
57 | chown -R root.root . |
---|
58 | find . -perm 775 -exec chmod 755 {} \; |
---|
59 | find . -perm 664 -exec chmod 644 {} \; |
---|
60 | # We want to use /var/run/named/, not just /var/run/. |
---|
61 | # This allows changing the ownership of that directory if we want to run |
---|
62 | # named as a non-root user. |
---|
63 | zcat $CWD/bind.var.run.named.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 |
---|
64 | # Threads break '-u' on Linux (for now) |
---|
65 | CFLAGS="$SLKCFLAGS" \ |
---|
66 | ./configure \ |
---|
67 | --prefix=/usr \ |
---|
68 | --sysconfdir=/etc \ |
---|
69 | --localstatedir=/var \ |
---|
70 | --with-libtool \ |
---|
71 | --enable-shared \ |
---|
72 | --disable-threads \ |
---|
73 | --with-openssl=/usr \ |
---|
74 | $ARCH-slackware-linux || exit 1 |
---|
75 | make -j1 || exit 1 |
---|
76 | cat isc-config.sh > $PKG/usr/bin/isc-config.sh |
---|
77 | chmod 755 $PKG/usr/bin/isc-config.sh |
---|
78 | chown root.bin $PKG/usr/bin/isc-config.sh |
---|
79 | cat contrib/named-bootconf/named-bootconf.sh > $PKG/usr/sbin/named-bootconf.sh |
---|
80 | cd bin/check/.libs |
---|
81 | cat named-checkconf > $PKG/usr/sbin/named-checkconf |
---|
82 | cat named-checkzone > $PKG/usr/sbin/named-checkzone |
---|
83 | cd ../../dig/.libs |
---|
84 | cat dig > $PKG/usr/bin/dig |
---|
85 | cat host > $PKG/usr/bin/host |
---|
86 | cat nslookup > $PKG/usr/bin/nslookup |
---|
87 | cd ../../dnssec/.libs |
---|
88 | cat dnssec-keygen > $PKG/usr/sbin/dnssec-keygen |
---|
89 | # obsolete |
---|
90 | #cat dnssec-makekeyset > $PKG/usr/sbin/dnssec-makekeyset |
---|
91 | #cat dnssec-signkey > $PKG/usr/sbin/dnssec-signkey |
---|
92 | cat dnssec-signzone > $PKG/usr/sbin/dnssec-signzone |
---|
93 | cd ../../named/.libs |
---|
94 | #rm lwresd |
---|
95 | cat named > $PKG/usr/sbin/named |
---|
96 | ( cd $PKG/usr/sbin ; ln -sf named lwresd ) |
---|
97 | cd ../../nsupdate/.libs |
---|
98 | cat nsupdate > $PKG/usr/bin/nsupdate |
---|
99 | cd ../../rndc/.libs |
---|
100 | cat rndc > $PKG/usr/sbin/rndc |
---|
101 | cat rndc-confgen > $PKG/usr/sbin/rndc-confgen |
---|
102 | cd .. |
---|
103 | mkdir -p $PKG/usr/doc/bind-$VERSION/misc |
---|
104 | cat rndc.conf > $PKG/usr/doc/bind-$VERSION/misc/rndc.conf-sample |
---|
105 | chmod 600 $PKG/usr/doc/bind-$VERSION/misc/rndc.conf-sample |
---|
106 | cd ../../lib/bind9/.libs |
---|
107 | cp -a libbind9.so.* $PKG/usr/lib || exit 1 |
---|
108 | #chmod 755 $PKG/usr/lib/libbind9.so.* |
---|
109 | #( cd $PKG/usr/lib ; rm -rf libbind9.so.${LIBBINDMAJOR} ; ln -sf libbind9.so.${LIBBINDVER} libbind.so.${LIBBINDMAJOR} ) |
---|
110 | cd ../../dns/.libs |
---|
111 | cp -a libdns.so.* $PKG/usr/lib || exit 1 |
---|
112 | #chmod 755 $PKG/usr/lib/libdns.so.${LIBDNSVER} |
---|
113 | #( cd $PKG/usr/lib ; rm -rf libdns.so.${LIBDNSMAJOR} ; ln -sf libdns.so.${LIBDNSVER} libdns.so.${LIBDNSMAJOR} ) |
---|
114 | cd ../../isc/.libs |
---|
115 | cp -a libisc.so.* $PKG/usr/lib || exit 1 |
---|
116 | #chmod 755 $PKG/usr/lib/libisc.so.${LIBISCVER} |
---|
117 | #( cd $PKG/usr/lib ; rm -rf libisc.so.${LIBISCMAJOR} ; ln -sf libisc.so.${LIBISCVER} libisc.so.${LIBISCMAJOR} ) |
---|
118 | cd ../../isccc/.libs |
---|
119 | cp -a libisccc.so.* $PKG/usr/lib || exit 1 |
---|
120 | #chmod 755 $PKG/usr/lib/libisccc.so.${LIBISCCCVER} |
---|
121 | #( cd $PKG/usr/lib ; rm -rf libisccc.so.${LIBISCCCMAJOR} ; ln -sf libisccc.so.${LIBISCCCVER} libisccc.so.${LIBISCCCMAJOR} ) |
---|
122 | cd ../../isccfg/.libs |
---|
123 | cp -a libisccfg.so.* $PKG/usr/lib || exit 1 |
---|
124 | #chmod 755 $PKG/usr/lib/libisccfg.so.${LIBISCCFGVER} |
---|
125 | #( cd $PKG/usr/lib ; rm -rf libisccfg.so.${LIBISCCFGMAJOR} ; ln -sf libisccfg.so.${LIBISCCFGVER} libisccfg.so.${LIBISCCFGMAJOR} ) |
---|
126 | cd ../../lwres/.libs |
---|
127 | cp -a liblwres.so.* $PKG/usr/lib || exit 1 |
---|
128 | #chmod 755 $PKG/usr/lib/liblwres.so.${LIBLWRESVER} |
---|
129 | #( cd $PKG/usr/lib ; rm -rf liblwres.so.${LIBLWRESMAJOR} ; ln -sf liblwres.so.${LIBLWRESVER} liblwres.so.${LIBLWRESMAJOR} ) |
---|
130 | #mkdir -p $PKG/usr/man/man{1,5,8} |
---|
131 | cd ../../../bin |
---|
132 | cat dig/dig.1 | gzip -9c > $PKG/usr/man/man1/dig.1.gz |
---|
133 | cat dig/host.1 | gzip -9c > $PKG/usr/man/man1/host.1.gz |
---|
134 | cat rndc/rndc.conf.5 | gzip -9c > $PKG/usr/man/man5/rndc.conf.5.gz |
---|
135 | cat check/named-checkconf.8 | gzip -9c > $PKG/usr/man/man8/named-checkconf.8.gz |
---|
136 | cat check/named-checkzone.8 | gzip -9c > $PKG/usr/man/man8/named-checkzone.8.gz |
---|
137 | cat dnssec/dnssec-keygen.8 | gzip -9c > $PKG/usr/man/man8/dnssec-keygen.8.gz |
---|
138 | # obsolete |
---|
139 | #cat dnssec/dnssec-makekeyset.8 | gzip -9c > $PKG/usr/man/man8/dnssec-makekeyset.8.gz |
---|
140 | #cat dnssec/dnssec-signkey.8 | gzip -9c > $PKG/usr/man/man8/dnssec-signkey.8.gz |
---|
141 | cat dnssec/dnssec-signzone.8 | gzip -9c > $PKG/usr/man/man8/dnssec-signzone.8.gz |
---|
142 | cat named/lwresd.8 | gzip -9c > $PKG/usr/man/man8/lwresd.8.gz |
---|
143 | cat named/named.8 | gzip -9c > $PKG/usr/man/man8/named.8.gz |
---|
144 | cat nsupdate/nsupdate.8 | gzip -9c > $PKG/usr/man/man8/nsupdate.8.gz |
---|
145 | cat rndc/rndc-confgen.8 | gzip -9c > $PKG/usr/man/man8/rndc-confgen.8.gz |
---|
146 | cat rndc/rndc.8 | gzip -9c > $PKG/usr/man/man8/rndc.8.gz |
---|
147 | cd ../doc |
---|
148 | mkdir -p $PKG/usr/doc/bind-$VERSION |
---|
149 | cp -a arm misc $PKG/usr/doc/bind-$VERSION |
---|
150 | cd .. |
---|
151 | cp -a CHANGES COPYRIGHT FAQ README $PKG/usr/doc/bind-$VERSION |
---|
152 | ( cd $PKG/usr/doc/bind-$VERSION |
---|
153 | find . -type f | xargs chmod 644 |
---|
154 | # This one should have the correct perms of the config file: |
---|
155 | chmod 600 misc/rndc.conf-sample ) |
---|
156 | ( cd $PKG |
---|
157 | find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
158 | find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
159 | ) |
---|
160 | |
---|
161 | # Add sample config files for a simple caching nameserver: |
---|
162 | |
---|
163 | cat $CWD/caching-example/named.conf > $PKG/etc/named.conf.new |
---|
164 | cat $CWD/caching-example/localhost.zone > $PKG/var/named/caching-example/localhost.zone |
---|
165 | cat $CWD/caching-example/named.ca > $PKG/var/named/caching-example/named.ca |
---|
166 | cat $CWD/caching-example/named.local > $PKG/var/named/caching-example/named.local |
---|
167 | |
---|
168 | mkdir -p $PKG/install |
---|
169 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
170 | |
---|
171 | mkdir -p $PKG/service/bind |
---|
172 | cp $CWD/run $PKG/service/bind/run |
---|
173 | chmod +x $PKG/service/bind/run || exit 1 |
---|
174 | |
---|
175 | rm -r $PKG/etc/rc.d |
---|
176 | |
---|
177 | # Build seperate tools package |
---|
178 | mkdir -p /tmp/bindtools/usr |
---|
179 | mv $PKG/usr/bin /tmp/bindtools/usr || exit 1 |
---|
180 | mv $PKG/usr/lib /tmp/bindtools/usr || exit 1 |
---|
181 | |
---|
182 | pushd /tmp/bindtools |
---|
183 | NAME=bind_tools |
---|
184 | makepkg -l y -c n $CWD/$NAME.pkg > /dev/null || exit 1 |
---|
185 | echo $PVER > $CWD/$NAME.version || exit 1 |
---|
186 | echo $ARCH > $CWD/$NAME.arch || exit 1 |
---|
187 | popd |
---|
188 | |
---|
189 | # Build the package: |
---|
190 | cd $PKG |
---|
191 | NAME=`echo $0|cut -f2 -d'.'` |
---|
192 | makepkg -l y -c n $CWD/$NAME.pkg > /dev/null || exit 1 |
---|
193 | echo $PVER > $CWD/$NAME.version || exit 1 |
---|
194 | echo $ARCH > $CWD/$NAME.arch || exit 1 |
---|
195 | |
---|
196 | |
---|
197 | |
---|