- $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) do_linux-shared
-
-$(STAGING_DIR)/lib/libssl.so: $(PKG_BUILD_DIR)/apps/openssl
- $(MAKE) CC=$(TARGET_CC) INSTALL_PREFIX=$(STAGING_DIR) -C $(PKG_BUILD_DIR) install_sw
- cp -fa $(PKG_BUILD_DIR)/libcrypto.so* $(STAGING_DIR)/lib/
- chmod a-x $(STAGING_DIR)/lib/libcrypto.so.0.9.7
- (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so)
- (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so.0)
- cp -fa $(PKG_BUILD_DIR)/libssl.so* $(STAGING_DIR)/lib/
- chmod a-x $(STAGING_DIR)/lib/libssl.so.0.9.7
- (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so)
- (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so.0)
-
-$(PACKAGE_DIR)/$(PKG_IPK): $(STAGING_DIR)/lib/libssl.so
- mkdir -p $(PACKAGE_DIR)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
- cp -a $(STAGING_DIR)/lib/libssl.so* $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
- cp -a $(STAGING_DIR)/lib/libcrypto.so* $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
- $(STRIP) $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib/*
- $(IPKG_BUILD) $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/openssl.list: $(PKG_IPK)
- $(IPKG) install $(PKG_IPK)
-
-source: $(DL_DIR)/$(PKG_SOURCE_FILE)
-prepare: $(PKG_BUILD_DIR)/.patched
-compile: $(STAGING_DIR)/lib/libssl.so $(PACKAGE_DIR)/$(PKG_IPK)
-install: $(PKG_ZLIB) $(IPKG_STATE_DIR)/info/openssl.list
-
-clean:
- rm -rf $(PKG_BUILD_DIR)
- rm -f $(STAGING_DIR)/lib/libssl*
- rm -f $(STAGING_DIR)/lib/libcrypto*
- rm -f $(PKG_IPK)
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
+ $(OPENSSL_MAKEFLAGS) \
+ do_linux-shared
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+ $(OPENSSL_MAKEFLAGS) \
+ install
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
+ [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc || true
+endef
+
+define Package/libopenssl/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
+endef
+
+define Package/openssl-util/install
+ $(INSTALL_DIR) $(1)/etc/ssl
+ $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
+ $(INSTALL_DIR) $(1)/etc/ssl/certs
+ $(INSTALL_DIR) $(1)/etc/ssl/private
+ chmod 0700 $(1)/etc/ssl/private
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
+endef