packages: fix parallel build by adding + for every make command that passes the jobserver
[packages.git] / libs / jpeg / Makefile
index 64b39a9..62c8c86 100644 (file)
@@ -1,10 +1,9 @@
 # 
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -17,8 +16,10 @@ PKG_SOURCE_URL:=http://www.ijg.org/files/ \
         ftp://ftp.uu.net/graphics/jpeg/
 PKG_MD5SUM:=dbd5f3b47ed13132f04c685d608a7547
 
-PKG_FIXUP = libtool
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=libltdl
 
+include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 
 define Package/jpeg/Default
@@ -47,32 +48,38 @@ CONFIGURE_ARGS += \
        --enable-shared \
        --enable-static \
 
+HOST_CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
 define Build/Prepare
        $(call Build/Prepare/Default)
-       # replace the old upstream libtool stuff with our own
-       ln -sf $(STAGING_DIR)/host/bin/libtool $(PKG_BUILD_DIR)/
-       ln -sf $(STAGING_DIR)/host/share/libtool/config.sub $(PKG_BUILD_DIR)/
-       ln -sf $(STAGING_DIR)/host/share/libtool/config.guess $(PKG_BUILD_DIR)/
-       ln -sf $(STAGING_DIR)/host/share/libtool/ltmain.sh $(PKG_BUILD_DIR)/
-       ln -sf /bin/true $(PKG_BUILD_DIR)/ltconfig
+       (cd $(PKG_BUILD_DIR); \
+               rm -f ltconfig ltmain.sh libtool; \
+               ln -s `which true` ltconfig; \
+               ln -s $(STAGING_DIR)/host/bin/libtool libtool; \
+       )
 endef
 
 define Build/Compile
-       rm -rf $(PKG_INSTALL_DIR)
-       mkdir -p $(PKG_INSTALL_DIR)/usr/{include,lib,bin,man/man1}
-       $(MAKE) -C $(PKG_BUILD_DIR) \
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/{include,lib,bin,man/man1}
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                LIBTOOL="./libtool --tag=CC" \
                prefix="$(PKG_INSTALL_DIR)/usr" \
                exec_prefix="$(PKG_INSTALL_DIR)/usr" \
-               all install install-headers install-lib
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               prefix="$(PKG_INSTALL_DIR)/usr" \
+               exec_prefix="$(PKG_INSTALL_DIR)/usr" \
+               install install-headers install-lib
 endef
 
 define Build/InstallDev
-       mkdir -p $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/jpeglib.h $(1)/usr/include/
        $(CP) $(PKG_BUILD_DIR)/jpegint.h $(1)/usr/include/
        $(CP) $(PKG_INSTALL_DIR)/usr/include/j{config,error,morecfg}.h $(1)/usr/include/
-       mkdir -p $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjpeg.{a,so*} $(1)/usr/lib/
 endef
 
@@ -86,5 +93,6 @@ define Package/jpeg-tools/install
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/*jpeg* $(1)/usr/bin/
 endef
 
+$(eval $(call HostBuild))
 $(eval $(call BuildPackage,libjpeg))
 $(eval $(call BuildPackage,jpeg-tools))