From: Jo-Philipp Wich Date: Fri, 23 Jul 2010 19:49:19 +0000 (+0000) Subject: use host opkg for installing packages in buildroot and ImageBuilder X-Git-Tag: reboot~19308 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8c1d9afc409fa26245256b91eb045a2f50f54c92;p=openwrt%2Fstaging%2Fchunkeey.git use host opkg for installing packages in buildroot and ImageBuilder SVN-Revision: 22372 --- diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 87b142aa59..57b06c86d8 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -1,17 +1,20 @@ # -# Copyright (C) 2006,2007 OpenWrt.org +# Copyright (C) 2006-2010 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # # where to build (and put) .ipk packages -IPKG:= \ +OPKG:= \ IPKG_TMP=$(TMP_DIR)/ipkg \ IPKG_INSTROOT=$(TARGET_DIR) \ IPKG_CONF_DIR=$(STAGING_DIR)/etc \ IPKG_OFFLINE_ROOT=$(TARGET_DIR) \ - $(SCRIPT_DIR)/ipkg -force-defaults -force-depends + $(STAGING_DIR_HOST)/bin/opkg \ + -f $(STAGING_DIR)/etc/opkg.conf \ + --force-depends \ + --force-overwrite # invoke ipkg-build with some default options IPKG_BUILD:= \ @@ -76,7 +79,7 @@ ifeq ($(DUMP),) rm -rf $(STAGING_DIR_ROOT)/tmp-$(1) touch $$@ - $$(IPKG_$(1)): $(STAGING_DIR)/etc/ipkg.conf $(STAMP_BUILT) + $$(IPKG_$(1)): $(STAGING_DIR)/etc/opkg.conf $(STAMP_BUILT) @rm -f $(PACKAGE_DIR)/$(1)_* rm -rf $$(IDIR_$(1)) mkdir -p $$(IDIR_$(1))/CONTROL @@ -111,7 +114,8 @@ ifeq ($(DUMP),) @[ -f $$(IPKG_$(1)) ] || false $$(INFO_$(1)): $$(IPKG_$(1)) - $(IPKG) install $$(IPKG_$(1)) + @[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp + $(OPKG) install $$(IPKG_$(1)) $(1)-clean: rm -f $(PACKAGE_DIR)/$(1)_* @@ -120,9 +124,11 @@ ifeq ($(DUMP),) endef - $(STAGING_DIR)/etc/ipkg.conf: + $(STAGING_DIR)/etc/opkg.conf: mkdir -p $(STAGING_DIR)/etc - echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf - echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf + ( echo "dest root /" > $@; \ + echo "arch all 100" >> $@; \ + echo "arch $(PKGARCH) 200" >> $@; \ + echo "option offline_root $(TARGET_DIR)" >> $@ ) endif diff --git a/package/Makefile b/package/Makefile index 5468bdc718..530405cd06 100644 --- a/package/Makefile +++ b/package/Makefile @@ -20,6 +20,9 @@ ifneq ($(IGNORE_ERRORS),) $(curdir)/builddirs-ignore-compile:= $(if $(filter m y, $(IGNORE_ERRORS)),$(foreach m,$(IGNORE_ERRORS),$(package-$(m))),$(package-m)) endif +$(curdir)/opkghost: $(TMP_DIR)/.build + @-$(MAKE) package/opkg/host/install + $(curdir)/install:=$(curdir)/install-cleanup $(curdir)/cleanup: $(TMP_DIR)/.build @@ -88,9 +91,10 @@ $(curdir)/index: FORCE $(curdir)/flags-install:= -j1 $(eval $(call stampfile,$(curdir),package,prereq,.config)) -$(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build)) -$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build)) -$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build)) -$(eval $(call stampfile,$(curdir),package,rootfs-prepare,$(TMP_DIR)/.build)) +$(eval $(call stampfile,$(curdir),package,cleanup)) +$(eval $(call stampfile,$(curdir),package,compile)) +$(eval $(call stampfile,$(curdir),package,opkghost)) +$(eval $(call stampfile,$(curdir),package,install,$(STAGING_DIR)/stamp/.package_opkghost)) +$(eval $(call stampfile,$(curdir),package,rootfs-prepare)) $(eval $(call subdir,$(curdir))) diff --git a/package/opkg/Makefile b/package/opkg/Makefile index c18f8e7319..3a5ba449f1 100644 --- a/package/opkg/Makefile +++ b/package/opkg/Makefile @@ -18,7 +18,9 @@ PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION) PKG_SOURCE_URL:=http://opkg.googlecode.com/svn/trunk/ PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz PKG_FIXUP = libtool + include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define Package/opkg SECTION:=base @@ -80,3 +82,25 @@ define Build/InstallDev endef $(eval $(call BuildPackage,opkg)) + + +HOST_CONFIGURE_ARGS += \ + --disable-curl \ + --disable-gpg \ + --with-opkgetcdir=/etc \ + --with-opkglockfile=/tmp/opkg.lock + +define Host/Configure + (cd $(HOST_BUILD_DIR); autoreconf -v --install || exit 1) + $(call Host/Configure/Default) +endef + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all +endef + +define Host/Install + $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg +endef + +$(eval $(call HostBuild)) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index b72e3f1724..2e1e82f866 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -52,12 +52,15 @@ help: FORCE # override variables from rules.mk PACKAGE_DIR:=$(TOPDIR)/packages -IPKG:= \ +OPKG:= \ IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \ IPKG_INSTROOT="$(TARGET_DIR)" \ IPKG_CONF_DIR="$(TOPDIR)/tmp" \ IPKG_OFFLINE_ROOT="$(TARGET_DIR)" \ - $(SCRIPT_DIR)/ipkg -force-defaults + $(STAGING_DIR_HOST)/bin/opkg \ + -f $(TOPDIR)/tmp/opkg.conf \ + --force-depends \ + --force-overwrite define Profile $(eval $(call Profile/Default)) @@ -79,10 +82,18 @@ _call_info: FORCE echo 'Available Profiles:' echo; $(PROFILE_LIST) -$(TOPDIR)/tmp/ipkg.conf: FORCE +$(TOPDIR)/tmp/opkg.conf: FORCE @mkdir -p $(TOPDIR)/tmp + @mkdir -p $(TARGET_DIR)/tmp @echo 'dest root /' > $@ @echo 'src packages file:$(PACKAGE_DIR)' >> $@ + @echo 'arch all 100' >> $@ + ifneq ($(CONFIG_TARGET_adm5120),y) + @echo 'arch $(BOARD) 200' >> $@ + else + @echo 'arch $(BOARD)_$(ARCH) 200' >> $@ + endif + @echo 'option offline_root $(TARGET_DIR)' >> $@ BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list @@ -102,18 +113,18 @@ endif $(MAKE) package_postinst $(MAKE) build_image -package_index: $(TOPDIR)/tmp/ipkg.conf FORCE +package_index: $(TOPDIR)/tmp/opkg.conf FORCE @echo @echo Building package index... (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \ gzip -9c Packages > Packages.gz \ ) >/dev/null 2>/dev/null - $(IPKG) update + $(OPKG) update package_install: FORCE @echo @echo Installing packages... - $(IPKG) install $(BUILD_PACKAGES) + $(OPKG) install $(BUILD_PACKAGES) copy_files: FORCE @echo @@ -121,6 +132,9 @@ copy_files: FORCE $(CP) $(USER_FILES)/* $(TARGET_DIR)/ package_postinst: FORCE + @echo + @echo Cleaning up + @rm -f $(TARGET_DIR)/tmp/opkg.lock @echo @echo Activating init scripts @( \