summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-11-10 00:08:15 (EST)
committer P. J. McDermott <pjm@nac.net>2012-11-10 00:08:15 (EST)
commita00164efc94da6953c78f59b2053b3af20fa16df (patch)
treeb4cdd25c2120a827099e3e78f160d81acad19453
parentccfa2c17cd966dc44380748af87afd796bcb7237 (diff)
Update build makefile (mostly "install" target).
* Read target architectures from generated configuration file. * Use new features of opkhelper (i.e. oh-autoinstall). * Remove libiberty.a. * Remove hard links to tools (in TOOLBINDIR). * Put ldscripts where we want them in a decent way. * Put BFD and opcodes libraries and headers where we want them in a decent way. * Fix creation of ld.so.conf.d. * Give ld.so conf files names that are specific to host architectures. * Run oh-fixperms.
-rwxr-xr-xbuild84
1 files changed, 38 insertions, 46 deletions
diff --git a/build b/build
index 1326229..f3144b0 100755
--- a/build
+++ b/build
@@ -21,7 +21,10 @@ configure:
done
# Generate all the individual program makefiles.
for target in $$(cat ../targets); do \
- oh-autobuild -B "build-$${target}" -T configure-host || \
+ oh-autobuild -B "build-$${target}" -T configure-host \
+ tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
+ bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
+ bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
touch $@
@@ -29,73 +32,62 @@ configure:
build: configure
# Build BFD header files.
for target in $$(cat ../targets); do \
- oh-autobuild -B "build-$${target}/bfd" -T headers || \
+ oh-autobuild -B "build-$${target}/bfd" -T headers \
+ tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
+ bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
+ bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
# Build ALL the things!
for target in $$(cat ../targets); do \
- oh-autobuild -B "build-$${target}" CFLAGS='$(CFLAGS)' || \
+ oh-autobuild -B "build-$${target}" CFLAGS='$(CFLAGS)' \
+ tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
+ bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
+ bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
touch $@
install: build
# Install everything.
- for target in $(PKG_TARGETS); do \
- cd "build-$${target}" && \
- make CFLAGS='$(CFLAGS)' \
- prefix="$${PWD}/../dest/usr" tooldir="$${PWD}/../dest/usr/tool" \
- bindir="$${PWD}/../dest/usr/bin/$(OH_HOST_ARCH)" \
- libdir="$${PWD}/../dest/usr/lib/$(OH_HOST_ARCH)" \
- install && \
- cd ..; \
- done
- # tooldir contains target ldscripts and hard links to tools.
- # Move ldscripts to where they belong and delete everything else.
+ # scriptdir contains target ldscripts.
# ldscripts should be independent of the host architecture and therefore
- # coinstallable with themselves across host architectures.
- for target in $(PKG_TARGETS); do \
- mv dest/usr/tool/lib/ldscripts "dest/usr/lib/$${target}" && \
- rm -Rf dest/usr/tool; \
- done
- # This is a kludge to put libiberty.a in the right place.
- # The problem is that libiberty's makefile asks GCC for a multilib
- # directory.
- liberty="$$(find dest/usr/lib -name libiberty.a)" && \
- mv "$${liberty}" dest/usr/lib/$(OH_HOST_ARCH) && \
- rmdir "$${liberty%/libiberty.a}"
- # Move BFD libraries and headers into multiarch locations.
- # This can't be done with *dir options; these paths are hardcoded in
- # bfd/configure.
- for target in $(PKG_TARGETS); do \
- target_arch_gnu=$$(oh-getarchitecture -t gnu "$${target}") && \
- mkdir dest/usr/include && \
- mkdir dest/usr/include/$(OH_HOST_ARCH) && \
- mv "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}/include" \
- "dest/usr/include/$(OH_HOST_ARCH)/$${target}" && \
- mv "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}/lib" \
- "dest/usr/lib/$(OH_HOST_ARCH)/$${target}" && \
- rmdir "dest/usr/$(OH_HOST_ARCH_GNU)/$${target_arch_gnu}"; \
+ # coinstallable with themselves across host architectures (I hope).
+ # All of these macro settings are effective thanks to
+ # `patches/01_pass-some-dirs-to-child-makes.patch`.
+ for target in $$(cat ../targets); do \
+ oh-autoinstall -B "build-$${target}" CFLAGS='$(CFLAGS)' \
+ tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
+ bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
+ bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
+ exit 1; \
done
- rmdir "dest/usr/$(OH_HOST_ARCH_GNU)" \
+ # /usr/tool/bin (TOOLBINDIR) contains hard links to tools. A quick look at
+ # the code suggests we don't need them; ld *should* work without them in any
+ # sane configuration.
+ rm -Rf dest/usr/tool
+ # We don't need a static libiberty.
+ find dest/usr/lib -name 'libiberty.a' -exec rm -f '{}' ';'
# Remove static library dependency metadata generated by libtool.
- rm -f dest/usr/lib/$(OH_HOST_ARCH)/*/*.la
+ find dest/usr/lib -name '*.la' -exec rm -f '{}' ';'
# Make symbolic links to native utilities.
- for target in $(PKG_TARGETS); do \
- if [ '$(OH_HOST_ARCH)' = "$${target}" ]; then \
+ for target in $$(cat ../targets); do \
+ if [ '$(OPK_HOST_ARCH)' = "$${target}" ]; then \
for util in "../dest/usr/bin/$${target}-"*; do \
ln -sf "$${util##*/}" "$${util%/*}/$${util##*/$${target}}"; \
done \
fi; \
done
# Write GNU ld configuration to point to BFD libraries.
- mkdir -p /etc/ld.so.conf.d
- for target in $(PKG_TARGETS); do \
- echo '# GNU BFD libraries' >"dest/etc/ld.so.conf.d/bdf-$${target}" && \
- echo "/usr/lib/$(OH_HOST_ARCH)/$${target}" \
- >>"dest/etc/ld.so.conf.d/bdf-$${target}"; \
+ mkdir -p dest/etc/ld.so.conf.d
+ for target in $$(cat ../targets); do \
+ echo '# GNU BFD libraries' \
+ >"dest/etc/ld.so.conf.d/bfd_$(OPK_HOST_ARCH)_$${target}" && \
+ echo "/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
+ >>"dest/etc/ld.so.conf.d/bfd_$(OPK_HOST_ARCH)_$${target}"; \
done
# Post-process and install everything.
+ oh-fixperms
oh-strip
oh-installfiles
touch $@