1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs target procps build
|
---|
4 | # -----------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG=procps-final.log
|
---|
13 |
|
---|
14 | set_libdirname
|
---|
15 | setup_multiarch
|
---|
16 |
|
---|
17 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
18 | BUILD_PREFIX=/usr
|
---|
19 | INSTALL_OPTIONS="DESTDIR=${LFS}"
|
---|
20 | else
|
---|
21 | BUILD_PREFIX="${TGT_TOOLS}"
|
---|
22 | INSTALL_OPTIONS="DESTDIR=${TGT_TOOLS}"
|
---|
23 | fi
|
---|
24 |
|
---|
25 | unpack_tarball procps-${PROCPS_VER} &&
|
---|
26 | cd ${PKGDIR}
|
---|
27 |
|
---|
28 | # Following sed implements the LFS procps patch
|
---|
29 | # apply_patch procps-${PROCPS_VER}
|
---|
30 | # (20030404: works for procps 3.1.5 - 3.1.8)
|
---|
31 | # Not required for 3.2.x
|
---|
32 | #test -f w.c-ORIG ||
|
---|
33 | # cp w.c w.c-ORIG
|
---|
34 | #sed 's@setlocale(LC_ALL, "")@setlocale(LC_NUMERIC, "C")@' w.c-ORIG \
|
---|
35 | # > w.c
|
---|
36 |
|
---|
37 | # Mod Makefile, pass extra LDFLAGS from env
|
---|
38 | # remove strip from install invocation, change install dirs to lib64 if biarch
|
---|
39 | # and change hard coded ncurses include search path of /usr/include/ncurses
|
---|
40 | # to look in ${TGT_TOOLS}/include
|
---|
41 |
|
---|
42 | test -f Makefile-ORIG ||
|
---|
43 | cp Makefile Makefile-ORIG
|
---|
44 |
|
---|
45 | LDFLAGS="-s"
|
---|
46 |
|
---|
47 | # modify install invocation to set --owner and --group to the
|
---|
48 | # user running this script.
|
---|
49 | # ( avoids issues during install if building as a non-root user )
|
---|
50 | uid=`id -u`
|
---|
51 | gid=`id -g`
|
---|
52 |
|
---|
53 | # TODO: need to check how lib64 is handled better in procps
|
---|
54 | # This is here based upon x86_64 only...
|
---|
55 | sed -e "s/LDFLAGS :=.*/& ${LDFLAGS}/" \
|
---|
56 | -e 's@--strip @@g' \
|
---|
57 | -e "s@^\(lib64.*:= \).*@\1${libdirname}@g" \
|
---|
58 | -e "s@/usr/include/ncurses@${BUILD_PREFIX}/include/ncurses@g" \
|
---|
59 | -e "/^install/s/--owner 0 --group 0/--owner ${uid} --group ${gid}/g" \
|
---|
60 | Makefile-ORIG > Makefile
|
---|
61 |
|
---|
62 | # same deal with --strip in proc/module.mk
|
---|
63 | # also remove invocation of ldconfig
|
---|
64 | test -f proc/module.mk-ORIG ||
|
---|
65 | mv proc/module.mk proc/module.mk-ORIG
|
---|
66 |
|
---|
67 | sed -e 's@--strip @@g' \
|
---|
68 | -e 's@$(ldconfig)@@g' \
|
---|
69 | -e "s@strip@${TARGET}-strip@g" \
|
---|
70 | proc/module.mk-ORIG > proc/module.mk
|
---|
71 |
|
---|
72 | # same deal with --strip in ps/module.mk
|
---|
73 | test -f ps/module.mk-ORIG ||
|
---|
74 | mv ps/module.mk ps/module.mk-ORIG
|
---|
75 |
|
---|
76 | sed -e 's@--strip @@g' \
|
---|
77 | ps/module.mk-ORIG > ps/module.mk
|
---|
78 |
|
---|
79 | max_log_init Procps ${PROCPS_VER} "Final (shared)" ${BUILDLOGS} ${LOG}
|
---|
80 | make CFLAGS="-O2 -pipe ${TGT_CFLAGS}" \
|
---|
81 | lib64=${libdirname} \
|
---|
82 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \
|
---|
83 | >> ${LOGFILE} 2>&1 &&
|
---|
84 | echo " o Build OK" &&
|
---|
85 |
|
---|
86 | # As per LFS CVS
|
---|
87 | min_log_init ${INSTLOGS} &&
|
---|
88 | make ${INSTALL_OPTIONS} \
|
---|
89 | lib64=${libdirname} \
|
---|
90 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" install \
|
---|
91 | >> ${LOGFILE} 2>&1 &&
|
---|
92 | echo " o ALL OK" || barf
|
---|
93 |
|
---|
94 | if [ ! "${USE_SYSROOT}" = "Y" ]; then
|
---|
95 | # if ${LFS}/bin does not exist, create it.
|
---|
96 | if [ ! -d ${LFS}/bin ]; then
|
---|
97 | mkdir ${LFS}/bin
|
---|
98 | fi
|
---|
99 |
|
---|
100 | cd ${LFS}/bin
|
---|
101 | ln -sf ..${TGT_TOOLS}/bin/kill .
|
---|
102 | fi
|
---|