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