- $(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)
-
-$(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 $(PACKAGE_DIR)/$(PKG_NAME)\*.ipk
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
+ do_linux-shared
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+ install
+endef
+
+define Build/InstallDev
+ mkdir -p $(STAGING_DIR)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
+ mkdir -p $(STAGING_DIR)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
+endef
+
+define Build/UninstallDev
+ rm -rf $(STAGING_DIR)/usr/include/openssl \
+ $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
+endef
+
+define Package/libopenssl/install
+ install -d -m0755 $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
+ chmod 0644 $(1)/usr/lib/*
+endef
+
+define Package/openssl-util/install
+ install -d -m0755 $(1)/etc/ssl
+ $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
+ install -d -m0755 $(1)/etc/ssl/certs
+ install -d -m0755 $(1)/etc/ssl/private
+ chmod 0700 $(1)/etc/ssl/private
+ install -d -m0755 $(1)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
+endef