- touch $(PKG_BUILD_DIR)/.built
-
-$(IPKG_ZLIB):
- install -m0755 -d $(IDIR_ZLIB)/usr/lib
- cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libz.so.* $(IDIR_ZLIB)/usr/lib/
- $(RSTRIP) $(IDIR_ZLIB)
- $(IPKG_BUILD) $(IDIR_ZLIB) $(PACKAGE_DIR)
-
-$(STAGING_DIR)/usr/lib/libz.so: $(PKG_BUILD_DIR)/.built
- mkdir -p $(STAGING_DIR)/usr/include
- cp -fpR $(PKG_INSTALL_DIR)/usr/include/z{conf,lib}.h $(STAGING_DIR)/usr/include
- mkdir -p $(STAGING_DIR)/usr/lib
- cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libz.{a,so*} $(STAGING_DIR)/usr/lib
- touch $(STAGING_DIR)/usr/lib/libz.so
-
-install-dev: $(STAGING_DIR)/usr/lib/libz.so
-
-uninstall-dev:
- rm -rf $(STAGING_DIR)/usr/include/z{conf,lib}.h
- rm -rf $(STAGING_DIR)/usr/lib/libz.{a,so*}
-
-compile: install-dev
-clean: uninstall-dev
+endef
+
+define Build/InstallDev
+ mkdir -p $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/z{conf,lib}.h \
+ $(1)/usr/include/
+ mkdir -p $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.{a,so*} \
+ $(1)/usr/lib/
+ mkdir -p $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/zlib.pc \
+ $(1)/usr/lib/pkgconfig/
+endef
+
+# libz.so is needed for openssl (zlib-dynamic)
+define Package/zlib/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,zlib))