From e240cc0ea62aa7404ccf6187cc95cf6370212bef Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 30 May 2006 18:55:52 +0000 Subject: [PATCH] improve dependency handling, fix some package makefile bugs git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3843 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 4 ++-- package/Makefile | 4 ++-- package/dropbear/Makefile | 3 +-- package/iproute2/Makefile | 10 ---------- package/ipsec-tools/Makefile | 2 +- package/ipset/Makefile | 3 +-- package/nvram/Makefile | 3 +-- package/pcmcia-cs/Makefile | 3 +-- package/ppp/Makefile | 4 ++-- package/robocfg/Makefile | 2 -- package/rules.mk | 9 ++++++++- package/udev/Makefile | 3 +-- package/wificonf/Makefile | 2 +- package/wireless-tools/Makefile | 8 ++++++-- package/zlib/Makefile | 1 - scripts/gen_deps.pl | 19 ++++++++++++++++--- scripts/gen_menuconfig.pl | 9 +++++++-- 17 files changed, 50 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 8a2e6bbb8..f93b00803 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,10 @@ config: scripts/config/conf config-clean: $(MAKE) -C scripts/config clean -package/%: +package/%: .pkginfo $(MAKE) -C package $(patsubst package/%,%,$@) -target/%: +target/%: .pkginfo $(MAKE) -C target $(patsubst target/%,%,$@) toolchain/%: diff --git a/package/Makefile b/package/Makefile index 0dc267017..adeb238d4 100644 --- a/package/Makefile +++ b/package/Makefile @@ -1,7 +1,7 @@ # Main makefile for the packages include $(TOPDIR)/rules.mk include $(TOPDIR)/.config -include .pkgdeps +include $(TOPDIR)/.pkgdeps COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m)) INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y)) @@ -20,7 +20,7 @@ $(STAMP_DIR) $(TARGET_DIR): $(MAKE) -C $(patsubst %-clean,%,$@) clean -.pkgdeps: $(TOPDIR)/.pkginfo +$(TOPDIR)/.pkgdeps: $(TOPDIR)/.pkginfo @$(TOPDIR)/scripts/gen_deps.pl < $< > $@ || rm -f $@ all: compile diff --git a/package/dropbear/Makefile b/package/dropbear/Makefile index 4a732ee83..28cdd15f7 100644 --- a/package/dropbear/Makefile +++ b/package/dropbear/Makefile @@ -25,10 +25,9 @@ endef define Package/dropbearconvert $(call Package/dropbear) -DEFAULT:=m TITLE:=Utility for converting SSH keys DESCRIPTION:=Utility for converting SSH keys -DEPENDS:=zlib +DEPENDS:=+zlib endef define Build/Configure diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile index c670ee5da..11336948f 100644 --- a/package/iproute2/Makefile +++ b/package/iproute2/Makefile @@ -14,25 +14,15 @@ PKG_CAT:=zcat include $(TOPDIR)/package/rules.mk -# define Package/iproute2 -# SECTION:=base -# CATEGORY:=Network -# DEFAULT:=n -# MENU:=1 -# TITLE:=A collection of utilites for controlling TCP/IP networking and Traffic Control -# endef - define Package/ip SECTION:=base CATEGORY:=Network -DEFAULT:=n DEPENDS:=iproute2 TITLE:=A routing control utility endef define Package/tc $(call Package/ip) -# DEPENDS:=kmod-sched TITLE:=A traffic control utility endef diff --git a/package/ipsec-tools/Makefile b/package/ipsec-tools/Makefile index e85f09d89..4b6bfe09e 100644 --- a/package/ipsec-tools/Makefile +++ b/package/ipsec-tools/Makefile @@ -19,7 +19,7 @@ include $(TOPDIR)/package/rules.mk define Package/ipsec-tools SECTION:=base CATEGORY:=Network -DEFAULT:=y +DEPENDS:=@LINUX_2_6 TITLE:=IPsec management tools DESCRIPTION:=IPsec management tools URL:=http://ipsec-tools.sourceforge.net/ diff --git a/package/ipset/Makefile b/package/ipset/Makefile index 8cfdee94e..7358f03a7 100644 --- a/package/ipset/Makefile +++ b/package/ipset/Makefile @@ -17,8 +17,7 @@ include $(TOPDIR)/package/rules.mk define Package/ipset SECTION:=base CATEGORY:=Network -DEFAULT:=y -DEPENDS:=kmod-iptables-extra +DEPENDS:=+kmod-iptables-extra TITLE:=Netfilter ip sets administration utility DESCRIPTION:=Netfilter ip sets administration utility URL:=http://ipset.netfilter.org/ diff --git a/package/nvram/Makefile b/package/nvram/Makefile index 3b9f82dbe..9cc6b9997 100644 --- a/package/nvram/Makefile +++ b/package/nvram/Makefile @@ -11,8 +11,7 @@ include $(TOPDIR)/package/rules.mk define Package/nvram SECTION:=base -# CATEGORY:=FIXME -DEFAULT:=n +DEPENDS:=@LINUX_2_4_BRCM TITLE:=Broadcom config utility DESCRIPTION:=control utility for broadcom's 'nvram' config area endef diff --git a/package/pcmcia-cs/Makefile b/package/pcmcia-cs/Makefile index 76e63d315..a389fd63e 100644 --- a/package/pcmcia-cs/Makefile +++ b/package/pcmcia-cs/Makefile @@ -18,8 +18,7 @@ include $(TOPDIR)/package/rules.mk define Package/pcmcia-cs SECTION:=base -# CATEGORY:=FIXME -DEFAULT:=n +DEPENDS:=@PCMCIA_SUPPORT TITLE:=PCMCIA/Cardbus management utilities DESCRIPTION:=PCMCIA/Cardbus management utilities URL:=http://pcmcia-cs.sourceforge.net/ diff --git a/package/ppp/Makefile b/package/ppp/Makefile index 0139eb051..2f0140030 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ppp PKG_VERSION:=2.4.3 PKG_RELEASE:=7 -PKG_BUILDDEP:=libpcap +PKG_BUILDDEP:=libpcap linux-atm PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -30,7 +30,7 @@ endef define Package/ppp-mod-pppoa SECTION:=net CATEGORY:=Network - DEPENDS:=ppp + DEPENDS:=ppp +linux-atm TITLE:=PPPoA plugin DESCRIPTION:=PPPoA (PPP over ATM) plugin for ppp endef diff --git a/package/robocfg/Makefile b/package/robocfg/Makefile index 8f89e7538..81cf99ac2 100644 --- a/package/robocfg/Makefile +++ b/package/robocfg/Makefile @@ -12,8 +12,6 @@ include $(TOPDIR)/package/rules.mk define Package/robocfg SECTION:=base -# CATEGORY:=FIXME -DEFAULT:=n TITLE:=BCM5325E/536x switch configuration utility DESCRIPTION:=Broadcom BCM5325E/536x switch configuration utility endef diff --git a/package/rules.mk b/package/rules.mk index 55066610d..d436df8dc 100644 --- a/package/rules.mk +++ b/package/rules.mk @@ -132,7 +132,14 @@ define BuildPackage mkdir -p $$(IDIR_$(1))/CONTROL echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control - echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control + ( \ + DEPENDS=; \ + for depend in $$(IDEPEND_$(1)); do \ + [ "$$$${depend%%%%%%%%[A-Za-z]*}" = "@" ] && continue; \ + DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \ + done; \ + echo "Depends: $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \ + ) echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control echo "Priority: $(PRIORITY)" >> $$(IDIR_$(1))/CONTROL/control diff --git a/package/udev/Makefile b/package/udev/Makefile index c7e5f4408..54e06dcff 100644 --- a/package/udev/Makefile +++ b/package/udev/Makefile @@ -23,8 +23,7 @@ include $(TOPDIR)/package/rules.mk define Package/udev SECTION:=base -# CATEGORY:=FIXME -DEFAULT:=n +DEPENDS:=@LINUX_2_6 TITLE:=Dynamic device management subsystem DESCRIPTION:=udev provides a dynamic device directory containing only the files for \\\ actually present devices. It creates or removes device node files in \\\ diff --git a/package/wificonf/Makefile b/package/wificonf/Makefile index 5fbaf0523..dc61267a7 100644 --- a/package/wificonf/Makefile +++ b/package/wificonf/Makefile @@ -12,7 +12,7 @@ include $(TOPDIR)/package/rules.mk define Package/wificonf SECTION:=base CATEGORY:=Network -DEFAULT:=y +DEPENDS:=nvram +wireless-tools TITLE:=replacement utility for wlconf DESCRIPTION:=Replacement utility for wlconf endef diff --git a/package/wireless-tools/Makefile b/package/wireless-tools/Makefile index 39a4ee6b6..17b59f841 100644 --- a/package/wireless-tools/Makefile +++ b/package/wireless-tools/Makefile @@ -42,12 +42,16 @@ define Package/wireless-tools/install install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/iw{config,getid,list,priv,spy} $(1)/usr/sbin/ endef -install-dev: $(PKG_BUILD_DIR)/.built +define Build/InstallDev mkdir -p $(STAGING_DIR)/usr/{lib,include} $(CP) $(PKG_BUILD_DIR)/libiw.so* $(STAGING_DIR)/usr/lib/ ln -sf libiw.so.28 $(STAGING_DIR)/usr/lib/libiw.so $(CP) $(PKG_BUILD_DIR)/{iwlib,wireless}.h $(STAGING_DIR)/usr/include/ +endef -uninstall-dev: +define Build/UninstallDev rm -f $(STAGING_DIR)/usr/lib/libiw.* rm -f $(STAGING_DIR)/usr/include/{iwlib,wireless}.h +endef + +$(eval $(call BuildPackage,wireless-tools)) diff --git a/package/zlib/Makefile b/package/zlib/Makefile index da9e6f461..33cbcceb2 100644 --- a/package/zlib/Makefile +++ b/package/zlib/Makefile @@ -20,7 +20,6 @@ include $(TOPDIR)/package/rules.mk define Package/zlib SECTION:=base CATEGORY:=Libraries -DEFAULT:=n TITLE:=Library implementing the deflate compression method DESCRIPTION:=A library implementing the 'deflate' compression method URL:=http://www.zlib.net/ diff --git a/scripts/gen_deps.pl b/scripts/gen_deps.pl index 40153bde3..d75f06d6f 100755 --- a/scripts/gen_deps.pl +++ b/scripts/gen_deps.pl @@ -5,6 +5,7 @@ my $name; my $src; my $makefile; my %pkg; +my %dep; my $line; while ($line = <>) { @@ -19,8 +20,12 @@ while ($line = <>) { $pkg{$name}->{src} = $src; }; $line =~ /^(Build-)?Depends: \s*(.+)\s*$/ and do { - my @dep = split /,\s*/, $2; - $pkg{$name}->{depends} = \@dep; + $pkg{$name}->{depends} ||= []; + foreach my $v (split /\s+/, $2) { + next if $v =~ /^@/; + $v =~ s/^\+//; + push @{$pkg{$name}->{depends}}, $v; + } }; } @@ -32,8 +37,16 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) { my $hasdeps = 0; my $depline = ""; foreach my $dep (@{$pkg{$name}->{depends}}) { + my $idx; if (defined $pkg{$dep}->{src} && $pkg{$name}->{src} ne $pkg{$dep}->{src}) { - $depline .= " $pkg{$dep}->{src}-compile"; + $idx = $pkg{$dep}->{src}; + } elsif (defined $pkg{$dep}) { + $idx = $dep; + } + if ($idx) { + next if $dep{$pkg{$name}->{src}."->".$idx}; + $depline .= " $idx\-compile"; + $dep{$pkg{$name}->{src}."->".$idx} = 1; } } if ($depline ne "") { diff --git a/scripts/gen_menuconfig.pl b/scripts/gen_menuconfig.pl index e282ee3ed..a7f939ff5 100755 --- a/scripts/gen_menuconfig.pl +++ b/scripts/gen_menuconfig.pl @@ -26,7 +26,12 @@ sub print_category($) { print "\t\ttristate \"$title\"\n"; print "\t\tdefault ".$pkg->{default}."\n"; foreach my $depend (@{$pkg->{depends}}) { - print "\t\tdepends PACKAGE_$depend\n"; + my $m = "depends"; + $depend =~ s/^([@\+])//; + my $flags = $1; + $flags =~ /@/ or $depend = "PACKAGE_$depend"; + $flags =~ /\+/ and $m = "select"; + print "\t\t$m $depend\n"; } print "\t\thelp\n"; print $pkg->{description}; @@ -60,7 +65,7 @@ while ($line = <>) { $line =~ /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1; $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; $line =~ /^Depends: \s*(.+)\s*$/ and do { - my @dep = split /,\s*/, $1; + my @dep = split /\s+/, $1; $pkg->{depends} = \@dep; }; $line =~ /^Category: \s*(.+)\s*$/ and do { -- 2.35.1