| 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | # cross-lfs native net-tools build
|
|---|
| 4 | # --------------------------------
|
|---|
| 5 | # $LastChangedBy$
|
|---|
| 6 | # $LastChangedDate$
|
|---|
| 7 | # $LastChangedRevision$
|
|---|
| 8 | # $HeadURL$
|
|---|
| 9 | #
|
|---|
| 10 |
|
|---|
| 11 | #set -x
|
|---|
| 12 | cd ${SRC}
|
|---|
| 13 | LOG=net-tools-native.log
|
|---|
| 14 |
|
|---|
| 15 | set_libdirname
|
|---|
| 16 | setup_multiarch
|
|---|
| 17 |
|
|---|
| 18 | unpack_tarball net-tools-${NETTOOLS_VER}
|
|---|
| 19 | cd ${PKGDIR}
|
|---|
| 20 |
|
|---|
| 21 | # TODO: get gcc version from gcc itself...
|
|---|
| 22 | case ${GCC_VER} in
|
|---|
| 23 | 3.4* | 4.* )
|
|---|
| 24 | # Fix some syntax so gcc-3.4 is kept happy
|
|---|
| 25 | # NOTE: this patch contains the miitool.c fix
|
|---|
| 26 | apply_patch net-tools-1.60-gcc34-3
|
|---|
| 27 | ;;
|
|---|
| 28 | * )
|
|---|
| 29 | # change string in miitool.c to something gcc-3.3 likes...
|
|---|
| 30 | # TODO: wrap some logic around this...
|
|---|
| 31 | apply_patch net-tools-1.60-miitool-gcc33-1
|
|---|
| 32 | ;;
|
|---|
| 33 | esac
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | # If we are building with 2.6 headers we need to adjust the x25
|
|---|
| 37 | # code in X25_setroute to use the size of "struct x25_address"
|
|---|
| 38 | # in the memcpy instead of "x25_address" ( x25_address is no longer
|
|---|
| 39 | # a typedef in <linux/x25.h> )
|
|---|
| 40 | case "${KERNEL_VER}" in
|
|---|
| 41 | 2.6* )
|
|---|
| 42 | test -f lib/x25_sr.c-ORIG ||
|
|---|
| 43 | mv lib/x25_sr.c lib/x25_sr.c-ORIG
|
|---|
| 44 |
|
|---|
| 45 | sed 's@\(sizeof(\)\(x25_address)\)@\1struct \2@g' \
|
|---|
| 46 | lib/x25_sr.c-ORIG > lib/x25_sr.c
|
|---|
| 47 | ;;
|
|---|
| 48 | esac
|
|---|
| 49 |
|
|---|
| 50 | # Have noticed an issue with x86_64 biarch and linux-libc-headers-2.6.5.1
|
|---|
| 51 | # iptunnel.c barfs out on redefinitions of 3 structs in <linux/if.h>
|
|---|
| 52 | # ( ifmap, ifreq and ifconf ) which are also available in <net/if.h>.
|
|---|
| 53 | # Removal of reference to <net/if.h> solved the issue...
|
|---|
| 54 | # TODO: look into this
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | # Check for previously created configuration files for target.
|
|---|
| 58 | # TODO: this really should go somewhere other than ${TARBALLS},
|
|---|
| 59 | # need a separate configs dir for the scripts for this and
|
|---|
| 60 | # kernel config...
|
|---|
| 61 |
|
|---|
| 62 | test -f ${TARBALLS}/net-tools-${NETTOOLS_VER}-config-${TARGET}.tar.bz2 &&
|
|---|
| 63 | {
|
|---|
| 64 | # Previously installed config files
|
|---|
| 65 | bzcat ${TARBALLS}/net-tools-${NETTOOLS_VER}-config-${TARGET}.tar.bz2 | \
|
|---|
| 66 | tar xvf -
|
|---|
| 67 | } || {
|
|---|
| 68 | # Will have to do it interactively, save config for reuse
|
|---|
| 69 | make config
|
|---|
| 70 |
|
|---|
| 71 | tar -cvf ${TARBALLS}/net-tools-${NETTOOLS_VER}-config-${TARGET}.tar config.h config.make config.status
|
|---|
| 72 | bzip2 ${TARBALLS}/net-tools-${NETTOOLS_VER}-config-${TARGET}.tar
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | # Fix hostname.c for decnet (pulls in <netdnet/dn.h>, should use <linux/dn.h>
|
|---|
| 76 | # NOTE: this doesn't fix it... cant be bothered looking into it,
|
|---|
| 77 | # just don't bother with decnet...
|
|---|
| 78 | test -f hostname.c-ORIG ||
|
|---|
| 79 | mv hostname.c hostname.c-ORIG
|
|---|
| 80 | sed 's@netdnet/dn.h@linux/dn.h@g' hostname.c-ORIG > hostname.c
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | # Have to pass SHELL="bash" to make so that we use bash's "test" as
|
|---|
| 84 | # /usr/bin/test under solaris (used when /bin/sh is invoked as it has no
|
|---|
| 85 | # builtin) doesn't understand -nt (newer than)
|
|---|
| 86 |
|
|---|
| 87 | max_log_init Net-tools ${NETTOOLS_VER} "native (shared)" ${BUILDLOGS} ${LOG}
|
|---|
| 88 | make SHELL="bash" \
|
|---|
| 89 | CC="${CC-gcc} ${ARCH_CFLAGS}" \
|
|---|
| 90 | COPTS="-D_GNU_SOURCE -O2 -Wall -pipe ${TGT_CFLAGS}" \
|
|---|
| 91 | LOPTS="-s" \
|
|---|
| 92 | >> ${LOGFILE} 2>&1 &&
|
|---|
| 93 | echo " o Build OK" &&
|
|---|
| 94 |
|
|---|
| 95 | min_log_init ${INSTLOGS} &&
|
|---|
| 96 | make update \
|
|---|
| 97 | >> ${LOGFILE} 2>&1 &&
|
|---|
| 98 | echo " o ALL OK" || barf
|
|---|
| 99 |
|
|---|