aboutsummaryrefslogtreecommitdiff
path: root/scripts/trylink
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-07 17:06:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-07 17:06:01 +0000
commitdef88985966a9351911844d42e06b735977bcb72 (patch)
tree99059022fef92213ec7f7adf7b80822f307bf38e /scripts/trylink
parent76a6b236a9e2654e8c296c61cf71e0cf8bf4a64c (diff)
downloadbusybox-def88985966a9351911844d42e06b735977bcb72.tar.gz
reviving libbusybox, adding CONFIG_INDIVIDUAL part 3
Diffstat (limited to 'scripts/trylink')
-rwxr-xr-xscripts/trylink53
1 files changed, 34 insertions, 19 deletions
diff --git a/scripts/trylink b/scripts/trylink
index c621b7c01..de60a2cf7 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -101,35 +101,50 @@ else
>/dev/null
fi
-mkdir 0lib 2>/dev/null
-test -d 0lib || exit 1
-ln -s libbusybox.so.1.8.0 0lib/libbusybox.so 2>/dev/null
+. .config
-EXE="0lib/libbusybox.so.1.8.0"
-try $CC $LDFLAGS \
+sharedlib_dir="0_lib"
+
+if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
+ mkdir "$sharedlib_dir" 2>/dev/null
+ test -d "$sharedlib_dir" || {
+ echo "Cannot make directory $sharedlib_dir"
+ exit 1
+ }
+ ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null
+
+ EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped"
+ try $CC $LDFLAGS \
-o $EXE -Wl,-Map -Wl,$EXE.map \
-shared -fPIC -Wl,--enable-new-dtags \
-Wl,--start-group -Wl,--whole-archive $A_FILES -Wl,--no-whole-archive -Wl,--end-group \
$l_list -Wl,--verbose \
- -Wl,-soname="libbusybox.so.1.8.0" \
+ -Wl,-soname="libbusybox.so.$BB_VER" \
-Wl,-z,combreloc \
>/dev/null \
-|| {
- echo "Linking $EXE failed"
- exit 1
-}
-strip -s --remove-section=.note --remove-section=.comment $EXE
+ || {
+ echo "Linking $EXE failed"
+ cat $EXE.out
+ exit 1
+ }
+ strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/libbusybox.so.$BB_VER"
+ echo "libbusybox: $sharedlib_dir/libbusybox.so.$BB_VER"
+fi
-EXE="0lib/busybox"
-try $CC $LDFLAGS \
+if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then
+ EXE="$sharedlib_dir/busybox_unstripped"
+ try $CC $LDFLAGS \
-o $EXE -Wl,-Map -Wl,$EXE.map \
-Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
-Wl,--start-group $O_FILES -Wl,--end-group \
$l_list -Wl,--verbose \
- -L"0lib" -lbusybox \
+ -L"$sharedlib_dir" -lbusybox \
>/dev/null \
-|| {
- echo "Linking $EXE failed"
- exit 1
-}
-strip -s --remove-section=.note --remove-section=.comment $EXE
+ || {
+ echo "Linking $EXE failed"
+ cat $EXE.out
+ exit 1
+ }
+ strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/busybox"
+ echo "busybox linked against libbusybox: $sharedlib_dir/busybox"
+fi