diff -X excl -rduNp busybox.oorig/applets/install.sh busybox/applets/install.sh --- busybox.oorig/applets/install.sh 2005-09-20 22:31:03.000000000 +0200 +++ busybox/applets/install.sh 2005-10-08 16:06:44.000000000 +0200 @@ -4,7 +4,8 @@ export LC_ALL=POSIX export LC_CTYPE=POSIX prefix=$1 -if [ "$prefix" = "" ]; then +# Some versions of [ can't deal with empty strings for the '=' operation +if [ "x$prefix" = "x" ]; then echo "No installation directory, aborting." exit 1; fi @@ -15,10 +16,20 @@ else fi h=`sort busybox.links | uniq` +# get the target dir for the libs; This is an incomplete/incorrect list for now +case $(uname -m) in +x86_64|ppc64*|sparc64*|ia64*|hppa*64*) libdir=/lib64 ;; +*) libdir=/lib ;; +esac rm -f $prefix/bin/busybox || exit 1 mkdir -p $prefix/bin || exit 1 +mkdir -p $prefix/$libdir || exit 1 install -m 755 busybox $prefix/bin/busybox || exit 1 +for i in libbusybox.so* +do + [ -f $i ] && install -m 644 $i $prefix/$libdir/ +done for i in $h ; do appdir=`dirname $i` diff -X excl -rduNp busybox.oorig/archival/libunarchive/Makefile.in busybox/archival/libunarchive/Makefile.in --- busybox.oorig/archival/libunarchive/Makefile.in 2005-09-20 22:30:25.000000000 +0200 +++ busybox/archival/libunarchive/Makefile.in 2005-10-09 01:00:06.000000000 +0200 @@ -1,27 +1,21 @@ # Makefile for busybox # -# Copyright (C) 1999-2004 by Erik Andersen -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# Copyright (C) 1999-2005 by Erik Andersen # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Licensed under the GPL v2, see the file LICENSE in this tarball. # LIBUNARCHIVE_AR:=libunarchive.a ifndef $(LIBUNARCHIVE_DIR) -LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/ +LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive endif -srcdir=$(top_srcdir)/archvial/libunarchive +srcdir=$(top_srcdir)/archival/libunarchive + +LIBUNARCHIVE-multi-obj:=$(LIBUNARCHIVE_DIR)/$(subst .a,-multi.o,$(LIBUNARCHIVE_AR)) +LIBUNARCHIVE-multi-pic:=$(LIBUNARCHIVE_DIR)/$(subst .a,-pic.o,$(LIBUNARCHIVE_AR)) + +libraries-m+=$(LIBUNARCHIVE-multi-pic) +libraries-y+=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR) LIBUNARCHIVE-y:= \ \ @@ -74,12 +68,20 @@ LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRE LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES) -libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR) LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y)) -$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y)) - $(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y)) -$(LIBUNARCHIVE_DIR)%.o: $(srcdir)/%.c +$(LIBUNARCHIVE-multi-obj): $(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(EXTRA_CFLAGS) -o $(@) -c $(^) + +$(LIBUNARCHIVE-multi-pic): $(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(CFLAGS_PIC) $(EXTRA_CFLAGS) -o $(@) -c $(^) + +#XXX: superseded $(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%, $(LIBUNARCHIVE-y)) +$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(LIBUNARCHIVE-multi-obj) + $(AR) $(ARFLAGS) $(@) $(^) + +#XXX: superseded +$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< diff -X excl -rduNp busybox.oorig/coreutils/libcoreutils/Makefile.in busybox/coreutils/libcoreutils/Makefile.in --- busybox.oorig/coreutils/libcoreutils/Makefile.in 2005-09-20 22:30:38.000000000 +0200 +++ busybox/coreutils/libcoreutils/Makefile.in 2005-10-09 01:01:03.000000000 +0200 @@ -1,37 +1,44 @@ # Makefile for busybox # -# Copyright (C) 1999-2004 by Erik Andersen -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# Copyright (C) 1999-2005 by Erik Andersen # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Licensed under the GPL v2, see the file LICENSE in this tarball. # LIBCOREUTILS_AR:=libcoreutils.a ifndef $(LIBCOREUTILS_DIR) -LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils/ +LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils endif srcdir=$(top_srcdir)/coreutils/libcoreutils +LIBCOREUTILS-multi-obj:=$(LIBCOREUTILS_DIR)/$(subst .a,-multi.o,$(LIBCOREUTILS_AR)) +LIBCOREUTILS-multi-pic:=$(LIBCOREUTILS_DIR)/$(subst .a,-pic.o,$(LIBCOREUTILS_AR)) + +libraries-m+=$(LIBCOREUTILS-multi-pic) +libraries-y+=$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR) + LIBCOREUTILS_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c -LIBCOREUTILS_OBJS=$(patsubst %.c,$(LIBCOREUTILS_DIR)%.o, $(LIBCOREUTILS_SRC)) +LIBCOREUTILS-y:= +LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o +LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o +LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o +LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o +LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o -libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR) +LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y)) -$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS) - $(AR) $(ARFLAGS) $@ $(LIBCOREUTILS_OBJS) +LIBCOREUTILS_OBJS=$(patsubst %,$(LIBCOREUTILS_DIR)/%, $(LIBCOREUTILS-y)) -$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< +$(LIBCOREUTILS-multi-obj):$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(EXTRA_CFLAGS) -o $(@) -c $(^) + +$(LIBCOREUTILS-multi-pic):$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(CFLAGS_PIC) $(EXTRA_CFLAGS) -o $(@) -c $(^) + +$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR): $(LIBCOREUTILS-multi-obj) + $(AR) $(ARFLAGS) $(@) $(^) + +#XXX: $(LIBCOREUTILS_DIR)/%.o: $(srcdir)/%.c +# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< diff -X excl -rduNp busybox.oorig/coreutils/uniq.c busybox/coreutils/uniq.c --- busybox.oorig/coreutils/uniq.c 2005-09-20 22:30:41.000000000 +0200 +++ busybox/coreutils/uniq.c 2005-10-09 00:39:37.000000000 +0200 @@ -4,20 +4,7 @@ * * Copyright (C) 2005 Manuel Novoa III * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * Licensed under the GPL v2, see the file LICENSE in this tarball. */ /* BB_AUDIT SUSv3 compliant */ @@ -29,7 +16,6 @@ #include #include #include "busybox.h" -#include "libcoreutils/coreutils.h" static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4"; diff -X excl -rduNp busybox.oorig/libbb/Makefile.in busybox/libbb/Makefile.in --- busybox.oorig/libbb/Makefile.in 2005-10-06 19:31:28.000000000 +0200 +++ busybox/libbb/Makefile.in 2005-10-08 23:48:14.000000000 +0200 @@ -4,42 +4,122 @@ # # Licensed under the GPL v2, see the file LICENSE in this tarball. -LIBBB_AR:=libbb.a ifndef $(LIBBB_DIR) -LIBBB_DIR:=$(top_builddir)/libbb/ +LIBBB_DIR:=$(top_builddir)/libbb endif srcdir=$(top_srcdir)/libbb +LIBBB_AR:=$(LIBBB_DIR)/libbb.a +libraries-y+=$(LIBBB_AR) + +LIBBB-multi-obj:=$(subst .a,-multi.o,$(LIBBB_AR)) +LIBBB-multi-pic:=$(subst .a,-pic.o,$(LIBBB_AR)) +libraries-m+=$(LIBBB-multi-pic) + LIBBB_SRC-y:= \ - bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ - compare_string_array.c concat_path_file.c copy_file.c copyfd.c \ - correct_password.c create_icmp_socket.c create_icmp6_socket.c \ - device_open.c dump.c error_msg.c error_msg_and_die.c find_mount_point.c \ - find_pid_by_name.c find_root_device.c fgets_str.c full_read.c \ - full_write.c get_last_path_component.c get_line_from_file.c \ - hash_fd.c herror_msg.c herror_msg_and_die.c \ - human_readable.c inet_common.c inode_hash.c interface.c isdirectory.c \ - kernel_version.c last_char_is.c login.c loop.c \ - make_directory.c mode_string.c mtab.c mtab_file.c \ - obscure.c parse_mode.c parse_number.c perror_msg.c \ - perror_msg_and_die.c print_file.c get_console.c \ - process_escape_sequence.c procps.c pw_encrypt.c qmodule.c \ - read_package_field.c recursive_action.c remove_file.c \ - restricted_shell.c run_parts.c run_shell.c safe_read.c safe_write.c \ - safe_strncpy.c setup_environment.c simplify_path.c \ - trim.c u_signal_names.c vdprintf.c verror_msg.c \ - vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c \ - xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \ - get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \ - getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \ - perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \ - warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c \ - bb_echo.c + ask_confirmation.c \ + bb_askpass.c \ + bb_asprintf.c \ + bb_echo.c \ + change_identity.c \ + chomp.c \ + compare_string_array.c \ + concat_path_file.c \ + concat_subpath_file.c \ + copyfd.c \ + copy_file.c \ + correct_password.c \ + create_icmp6_socket.c \ + create_icmp_socket.c \ + default_error_retval.c \ + device_open.c \ + dump.c \ + error_msg_and_die.c \ + error_msg.c \ + fclose_nonstdin.c \ + fflush_stdout_and_exit.c \ + fgets_str.c \ + find_mount_point.c \ + find_pid_by_name.c \ + find_root_device.c \ + full_read.c \ + full_write.c \ + get_console.c \ + get_last_path_component.c \ + get_line_from_file.c \ + getopt_ulflags.c \ + get_terminal_width_height.c \ + hash_fd.c \ + herror_msg_and_die.c \ + herror_msg.c \ + human_readable.c \ + inet_common.c \ + inode_hash.c \ + interface.c \ + isdirectory.c \ + kernel_version.c \ + last_char_is.c \ + login.c \ + loop.c \ + make_directory.c \ + mode_string.c \ + mtab.c \ + mtab_file.c \ + obscure.c \ + parse_mode.c \ + parse_number.c \ + perror_msg_and_die.c \ + perror_msg.c \ + perror_nomsg_and_die.c \ + perror_nomsg.c \ + print_file.c \ + process_escape_sequence.c \ + procps.c \ + pw_encrypt.c \ + qmodule.c \ + read_package_field.c \ + recursive_action.c \ + remove_file.c \ + restricted_shell.c \ + run_parts.c \ + run_shell.c \ + safe_read.c \ + safe_strncpy.c \ + safe_write.c \ + setup_environment.c \ + simplify_path.c \ + skip_whitespace.c \ + speed_table.c \ + trim.c \ + u_signal_names.c \ + vdprintf.c \ + verror_msg.c \ + vfork_daemon_rexec.c \ + vherror_msg.c \ + vperror_msg.c \ + warn_ignoring_args.c \ + wfopen.c \ + wfopen_input.c \ + xconnect.c \ + xgetcwd.c \ + xgethostbyname2.c \ + xgethostbyname.c \ + xgetlarg.c \ + xreadlink.c \ + xregcomp.c \ + +#above line left blank intentionally +# conditionally compiled objects: LIBBB_SRC-$(CONFIG_FEATURE_SHADOWPASSWDS)+= pwd2spwd.c -LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC-y)) +# all 1:1 objects +LIBBB_OBJS:=$(patsubst %.c,$(LIBBB_DIR)/%.o, $(LIBBB_SRC-y)) +LIBBB_SRC:=$(patsubst %,$(srcdir)/%,$(LIBBB_SRC-y)) +$(LIBBB_DIR)/%.o: $(srcdir)/%.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< +# 1:N objects LIBBB_MSRC0:=$(srcdir)/messages.c LIBBB_MOBJ0:=full_version.o \ memory_exhausted.o invalid_date.o io_error.o \ @@ -48,65 +128,75 @@ LIBBB_MOBJ0:=full_version.o \ shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \ securetty_file.o motd_file.o \ msg_standard_input.o msg_standard_output.o shell_file.o +LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0)) +$(LIBBB_MOBJ0):$(LIBBB_MSRC0) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC1:=$(srcdir)/xfuncs.c LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ xfopen.o xopen.o xread.o xread_all.o xread_char.o \ xferror.o xferror_stdout.o xfflush_stdout.o strlen.o +LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1)) +$(LIBBB_MOBJ1):$(LIBBB_MSRC1) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC2:=$(srcdir)/printf.c LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o +LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2)) +$(LIBBB_MOBJ2):$(LIBBB_MSRC2) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC3:=$(srcdir)/xgetularg.c LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o +LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3)) +$(LIBBB_MOBJ3):$(LIBBB_MSRC3) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC4:=$(srcdir)/safe_strtol.c LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o +LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4)) +$(LIBBB_MOBJ4):$(LIBBB_MSRC4) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC5:=$(srcdir)/bb_pwd.c LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ bb_getug.o get_ug_id.o +LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5)) +$(LIBBB_MOBJ5):$(LIBBB_MSRC5) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< LIBBB_MSRC6:=$(srcdir)/llist.c LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o +LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6)) +$(LIBBB_MOBJ6):$(LIBBB_MSRC6) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< -LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0)) -LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1)) -LIBBB_MOBJS2=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ2)) -LIBBB_MOBJS3=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ3)) -LIBBB_MOBJS4=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ4)) -LIBBB_MOBJS5=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ5)) -LIBBB_MOBJS6=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ6)) - -libraries-y+=$(LIBBB_DIR)$(LIBBB_AR) - -$(LIBBB_DIR)$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \ - $(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4) $(LIBBB_MOBJS5) \ - $(LIBBB_MOBJS6) - $(AR) $(ARFLAGS) $(@) $(LIBBB_OBJS) $(^) - -$(LIBBB_DIR)%.o: $(srcdir)/%.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< -$(LIBBB_MOBJS0): $(LIBBB_MSRC0) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +# We need the names of the object files built from MSRC for the L_ defines +LIBBB-ALL-MOBJ:= $(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) \ + $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6) -$(LIBBB_MOBJS1): $(LIBBB_MSRC1) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +LIBBB-ALL-MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \ + $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6) -$(LIBBB_MOBJS2): $(LIBBB_MSRC2) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +# all defines needed for 1:N objects +all-defs:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB-ALL-MOBJ)))) -$(LIBBB_MOBJS3): $(LIBBB_MSRC3) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +# These prerequisites should be generated so that only the actually used obj +# get built. XXX: Until then we hardcode them to list all.. +$(LIBBB-multi-obj): $(LIBBB_SRC) $(LIBBB-ALL-MSRC) -$(LIBBB_MOBJS4): $(LIBBB_MSRC4) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +# Generic Rule to build the multi object out of the prerequisites +$(LIBBB-multi-obj): + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(EXTRA_CFLAGS) \ + -o $(@) $(all-defs) -c $(^) -$(LIBBB_MOBJS5): $(LIBBB_MSRC5) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +$(LIBBB-multi-pic): $(LIBBB_SRC) $(LIBBB-ALL-MSRC) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(CFLAGS_PIC) $(EXTRA_CFLAGS) \ + -o $(@) $(all-defs) -c $(^) -$(LIBBB_MOBJS6): $(LIBBB_MSRC6) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ +#XXX: superseded $(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB-ALL-MOBJ) +$(LIBBB_AR): $(LIBBB-multi-obj) + $(AR) $(ARFLAGS) $(@) $(^) diff -X excl -rduNp busybox.oorig/libpwdgrp/Makefile.in busybox/libpwdgrp/Makefile.in --- busybox.oorig/libpwdgrp/Makefile.in 2005-09-24 11:25:36.000000000 +0200 +++ busybox/libpwdgrp/Makefile.in 2005-10-08 23:32:09.000000000 +0200 @@ -6,10 +6,15 @@ LIBPWDGRP_AR:=libpwdgrp.a ifndef $(LIBPWDGRP_DIR) -LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp/ +LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp endif srcdir=$(top_srcdir)/libpwdgrp +LIBPWDGRP-multi-obj:=$(LIBPWDGRP_DIR)/$(subst .a,-multi.o,$(LIBPWDGRP_AR)) +LIBPWDGRP-multi-pic:=$(LIBPWDGRP_DIR)/$(subst .a,-pic.o,$(LIBPWDGRP_AR)) + +libraries-y+=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR) +libraries-m+=$(LIBPWDGRP-multi-pic) LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \ @@ -17,23 +22,32 @@ LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP) getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \ getpwent_r.o getgrent_r.o getpwent.o getgrent.o \ initgroups.o putpwent.o putgrent.o -LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)%, $(LIBPWDGRP_MOBJ0-y)) +LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y)) LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \ __pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \ getspnam.o getspent_r.o getspent.o sgetspent.o \ putspent.o __parsespent.o # getspuid_r.o getspuid.o -LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)%, $(LIBPWDGRP_MOBJ1-y)) +LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y)) -libraries-y+=$(LIBPWDGRP_DIR)$(LIBPWDGRP_AR) +all-defs:=$(patsubst %,-DL_%,$(subst .o,,$(notdir LIBPWDGRP_MOBJS0 LIBPWDGRP_MOBJS1))) -$(LIBPWDGRP_DIR)$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1) - $(AR) $(ARFLAGS) $@ $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1) +$(LIBPWDGRP-multi-obj): $(LIBPWDGRP_MSRC0) #$(LIBPWDGRP_MSRC1) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(EXTRA_CFLAGS) \ + -o $(@) $(all-defs) -c $(<) + +$(LIBPWDGRP-multi-pic): $(LIBPWDGRP_MSRC0) #$(LIBPWDGRP_MSRC1) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(CFLAGS_PIC) $(EXTRA_CFLAGS) \ + -o $(@) $(all-defs) -c $(<) +#XXX: superseded $(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1) +$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP-multi-obj) + $(AR) $(ARFLAGS) $(@) $(^) +#XXX: superseded $(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ - +#XXX: superseded $(LIBPWDGRP_MOBJS1): $(LIBPWDGRP_MSRC1) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ diff -X excl -rduNp busybox.oorig/Makefile busybox/Makefile --- busybox.oorig/Makefile 2005-10-08 13:19:34.000000000 +0200 +++ busybox/Makefile 2005-10-09 19:54:04.000000000 +0200 @@ -183,6 +183,7 @@ randconfig: scripts/config/conf allyesconfig: scripts/config/conf @./scripts/config/conf -y $(CONFIG_CONFIG_IN) sed -i -r -e "s/^(CONFIG_DEBUG|USING_CROSS_COMPILER|CONFIG_STATIC|CONFIG_SELINUX).*/# \1 is not set/" .config + echo "CONFIG_FEATURE_SHARED_BUSYBOX=y" >> .config @./scripts/config/conf -o $(CONFIG_CONFIG_IN) allnoconfig: scripts/config/conf @@ -200,6 +201,33 @@ allbareconfig: scripts/config/conf else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) +# XXX: No idea how i can extract a valid soversion out of e.g. +# VERSION:=1.1.0-pre1 +so-version:=1.1.0 +$(warning warning: revisit soname and version..) +libbusybox-soname:=libbusybox.so.$(so-version) + +libbusybox-obj:=archival/libunarchive/libunarchive-pic.o \ + networking/libiproute/libiproute-pic.o \ + libpwdgrp/libpwdgrp-pic.o \ + coreutils/libcoreutils/libcoreutils-pic.o \ + libbb/libbb-pic.o +libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) + +libbusybox.so: $(libbusybox-obj) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -shared \ + $(CFLAGS_PIC) -msingle-pic-base \ + -Wl,-soname=$(libbusybox-soname) \ + -Wl,--enable-new-dtags -Wl,--reduce-memory-overheads \ + -Wl,-z,combreloc -Wl,-shared -Wl,--as-needed \ + -Wl,--warn-shared-textrel -Wl,--no-undefined-version \ + -o $(@) \ + -Wl,--whole-archive -Wl,--start-group $(^) \ + -Wl,--end-group -Wl,--no-whole-archive + @rm -f $(libbusybox-soname) + ln -s $(@) $(libbusybox-soname) + strip --remove-section=.note --remove-section=.comment --remove-section=.version --strip-debug --strip-unneeded $@ + all: busybox busybox.links doc # In this section, we need .config @@ -209,8 +237,23 @@ include $(patsubst %,%/Makefile.in, $(SR endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) -busybox: .depend $(libraries-y) - $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group +ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) +LIBBUSYBOX:=libbusybox.so +#LIBRARIES+= #-lcrypt +endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) + +ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) +libraries-y:=$(filter-out $(subst -pic.o,.a,$(libbusybox-obj)),$(libraries-y)) +LDBUSYBOX:=-L$(top_builddir) -lbusybox +else +# don't use the .a but just the -multi.o. Saves a very few bytes per object +_tmp:=$(filter $(subst -pic.o,.a,$(libbusybox-obj)),$(libraries-y)) +libraries-y:=$(filter-out $(subst -pic.o,.a,$(libbusybox-obj)),$(libraries-y)) +libraries-y+=$(subst .a,-multi.o,$(_tmp)) +endif # ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) + +busybox: .depend $(libraries-y) $(LIBBUSYBOX) + $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LDBUSYBOX) $(LIBRARIES) -Wl,--end-group $(STRIPCMD) $@ busybox.links: $(top_srcdir)/applets/busybox.mkll include/config.h $(top_srcdir)/include/applets.h @@ -245,6 +288,7 @@ ifdef V endif ifneq ($(strip $(KBUILD_VERBOSE)),) CHECK_VERBOSE := -v +# ARFLAGS+=v endif check test: busybox bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \ @@ -334,6 +378,7 @@ clean: - find . -name .\*.flags -exec rm -f {} \; - find . -name \*.o -exec rm -f {} \; - find . -name \*.a -exec rm -f {} \; + - find . -name \*.so -exec rm -f {} \; distclean: clean - rm -f scripts/bb_mkdep diff -X excl -rduNp busybox.oorig/networking/libiproute/Makefile.in busybox/networking/libiproute/Makefile.in --- busybox.oorig/networking/libiproute/Makefile.in 2005-09-20 22:30:11.000000000 +0200 +++ busybox/networking/libiproute/Makefile.in 2005-10-08 22:39:00.000000000 +0200 @@ -2,27 +2,21 @@ # # Copyright (C) 1999-2004 by Erik Andersen # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Licensed under the GPL v2, see the file LICENSE in this tarball. # LIBIPROUTE_AR:=libiproute.a ifndef $(LIBIPROUTE_DIR) -LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute/ +LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute endif srcdir=$(top_srcdir)/networking/libiproute +LIBIPROUTE-multi-obj:=$(LIBIPROUTE_DIR)/$(subst .a,-multi.o,$(LIBIPROUTE_AR)) +LIBIPROUTE-multi-pic:=$(LIBIPROUTE_DIR)/$(subst .a,-pic.o,$(LIBIPROUTE_AR)) + +libraries-y+=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR) +libraries-m+=$(LIBIPROUTE-multi-pic) + LIBIPROUTE-$(CONFIG_IP) += \ ip_parse_common_args.o \ ipaddress.o \ @@ -74,11 +68,19 @@ LIBIPROUTE-$(CONFIG_IPTUNNEL) += \ rt_names.o \ utils.o -libraries-y+=$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR) +LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y)) -$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y)) - $(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y)) +$(LIBIPROUTE-multi-obj):$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(EXTRA_CFLAGS) -o $(@) -c $(^) -$(LIBIPROUTE_DIR)%.o: $(srcdir)/%.c +$(LIBIPROUTE-multi-pic):$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y))) + $(CC) $(CFLAGS) $(CFLAGS_MULTI) $(CFLAGS_PIC) $(EXTRA_CFLAGS) -o $(@) -c $(^) + +#XXX: superseded $(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)/%, $(LIBIPROUTE-y)) +$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(LIBIPROUTE-multi-obj) + $(AR) $(ARFLAGS) $@ $(^) + +#XXX: superseded +$(LIBIPROUTE_DIR)/%.o: $(srcdir)/%.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< diff -X excl -rduNp busybox.oorig/README busybox/README --- busybox.oorig/README 2005-10-05 15:36:54.000000000 +0200 +++ busybox/README 2005-10-08 15:21:37.000000000 +0200 @@ -8,9 +8,9 @@ generally have fewer options than their options that are included provide the expected functionality and behave very much like their GNU counterparts. -BusyBox has been written with size-optimization and limited resources in mind. +BusyBox has been written with size-optimisation and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or -features) at compile time. This makes it easy to customize your embedded +features) at compile time. This makes it easy to customise your embedded systems. To create a working system, just add /dev, /etc, and a Linux kernel. BusyBox provides a fairly complete POSIX environment for any small or embedded system. @@ -59,7 +59,7 @@ Bugs: If you find bugs, please submit a detailed bug report to the BusyBox mailing list at busybox@mail.busybox.net. A well-written bug report should include a -transcript of a shell session that demonstrates the bad behavior and enables +transcript of a shell session that demonstrates the bad behaviour and enables anyone else to duplicate the bug on their own machine. The following is such an example: diff -X excl -rduNp busybox.oorig/Rules.mak busybox/Rules.mak --- busybox.oorig/Rules.mak 2005-10-05 15:36:54.000000000 +0200 +++ busybox/Rules.mak 2005-10-09 19:48:20.000000000 +0200 @@ -74,7 +74,7 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") -WARNINGS=-Wall -Wstrict-prototypes -Wshadow +WARNINGS=-Wall -Wstrict-prototypes -Wshadow CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) ARFLAGS=cru @@ -164,11 +164,21 @@ ifeq ($(strip $(CONFIG_DEBUG)),y) STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging else CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG - LDFLAGS += -Wl,-warn-common - STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment + LDFLAGS += -Wl,-warn-common -Wl,--sort-common -Wl,--gc-sections + STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment \ + --remove-section=.version endif ifeq ($(strip $(CONFIG_STATIC)),y) LDFLAGS += --static +else + LIBRARIES += -ldl +endif + +# Flags to pass to CC for building multi-objects +CFLAGS_MULTI:= -combine -pipe + +ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) + CFLAGS_PIC:= -fPIC #-DPIC endif ifeq ($(strip $(CONFIG_SELINUX)),y) diff -X excl -rduNp busybox.oorig/sysdeps/linux/Config.in busybox/sysdeps/linux/Config.in --- busybox.oorig/sysdeps/linux/Config.in 2005-09-20 22:30:59.000000000 +0200 +++ busybox/sysdeps/linux/Config.in 2005-10-09 12:54:56.000000000 +0200 @@ -164,6 +164,21 @@ config CONFIG_STATIC Most people will leave this set to 'N'. +config CONFIG_BUILD_LIBBUSYBOX + bool "Build shared libbusybox" + default y + help + Build a shared library libbusybox.so which contains all + libraries used inside busybox. + +config CONFIG_FEATURE_SHARED_BUSYBOX + bool "Use shared libbusybox for busybox" + default y if CONFIG_BUILD_LIBBUSYBOX + depends on !CONFIG_STATIC && CONFIG_BUILD_LIBBUSYBOX + help + Use libbusybox.so also for busybox itself. + You need to have a working dynamic linker to use this variant. + config CONFIG_LFS bool "Build with Large File Support (for accessing files > 2 GB)" default n @@ -220,26 +235,24 @@ config PREFIX help Define your directory to install BusyBox files/subdirs in. - - endmenu source archival/Config.in source coreutils/Config.in source console-tools/Config.in source debianutils/Config.in -source e2fsprogs/Config.in source editors/Config.in source findutils/Config.in source init/Config.in source loginutils/Config.in -source miscutils/Config.in +source e2fsprogs/Config.in source modutils/Config.in +source util-linux/Config.in +source miscutils/Config.in source networking/Config.in source procps/Config.in source shell/Config.in source sysklogd/Config.in -source util-linux/Config.in menu 'Debugging Options'