[packages] file: prevent spurious rebuilds, caused by touching files during Package/file/install, use Hooks/... instead, cleanup

git-svn-id: svn://svn.openwrt.org/openwrt/packages@20731 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2010-04-06 09:26:42 +00:00
parent fa4a738db8
commit 55681d24ca

View File

@ -20,50 +20,49 @@ PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/libmagic define Package/file/Default
SECTION:=libs TITLE:=File type determination
CATEGORY:=Libraries
DEPENDS:=+zlib
TITLE:=Determines file type using 'magic' numbers
URL:=ftp://ftp.astron.com/pub/file/ URL:=ftp://ftp.astron.com/pub/file/
endef endef
define Package/file define Package/file
$(call package/file/Default)
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
TITLE+= utility
DEPENDS:=+libmagic DEPENDS:=+libmagic
TITLE:=Determines file type using 'magic' numbers
URL:=ftp://ftp.astron.com/pub/file/
endef endef
define Package/file/description define Package/libmagic
File tests each argument in an attempt to classify it. There $(call package/file/Default)
are three sets of tests, performed in this order: filesystem SECTION:=libs
tests, magic number tests, and language tests. The first test CATEGORY:=Libraries
that succeeds causes the file type to be printed. TITLE+= library
DEPENDS:=+zlib
Starting with version 4, the file command is not much more than
a wrapper around the "magic" library.
endef endef
MAKE_PATH:=src CONFIGURE_ARGS += \
--enable-shared \
--enable-static \
MAKE_PATH := src
TARGET_CFLAGS += $(FPIC) TARGET_CFLAGS += $(FPIC)
define Build/Configure define Build/Compile/magic
$(call Build/Configure/Default, \ ( cd $(PKG_BUILD_DIR)/magic/Magdir; \
--enable-shared \ for f in `ls`; do \
--enable-static \ cat $$$${f}; \
--disable-rpath \ done \
--without-libiconv-prefix \ ) > $(PKG_BUILD_DIR)/magic/magic
--without-libintl-prefix \
)
endef endef
Hooks/Compile/Post += Build/Compile/magic
define Build/Prepare define Build/Install/magic
$(call Build/Prepare/Default) $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/file
chmod -R u+w $(PKG_BUILD_DIR) $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic $(PKG_INSTALL_DIR)/usr/share/file/
endef endef
Hooks/Install/Post += Build/Install/magic
define Build/InstallDev define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include $(INSTALL_DIR) $(1)/usr/include
@ -72,18 +71,17 @@ define Build/InstallDev
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
endef endef
define Package/file/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share/file
$(CP) $(PKG_INSTALL_DIR)/usr/share/file/magic $(1)/usr/share/file/
endef
define Package/libmagic/install define Package/libmagic/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
endef endef
define Package/file/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/share/file
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin
(cd $(PKG_BUILD_DIR)/magic/Magdir; rm -f magic.mime; for file in `ls`; do cat $$$${file} >> magic.mime; done)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/Magdir/magic.mime $(1)/usr/share/file/magic
endef
$(eval $(call BuildPackage,libmagic))
$(eval $(call BuildPackage,file)) $(eval $(call BuildPackage,file))
$(eval $(call BuildPackage,libmagic))