X-OpenWrt/CustomFiles/Patches/0003-upx-ucl-21.02.patch

137 lines
3.9 KiB
Diff
Executable File

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chuck <fanck0605@qq.com>
Date: Mon, 13 Jul 2020 13:09:02 +0800
Subject: [PATCH] tools: add ucl and upx compresss
Signed-off-by: Chuck <fanck0605@qq.com>
---
tools/Makefile | 3 ++-
tools/ucl/Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++++
tools/upx/Makefile | 35 +++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 tools/ucl/Makefile
create mode 100644 tools/upx/Makefile
diff --git a/tools/Makefile b/tools/Makefile
index a2665dbc9a..6dd93f3cfe 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -25,7 +25,7 @@ tools-y += autoconf autoconf-archive automake bc bison cmake dosfstools
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image
-tools-y += patchelf pkgconf quilt squashfskit4 sstrip zip zlib zstd
+tools-y += patchelf pkgconf quilt squashfskit4 sstrip ucl upx zip zlib zstd
tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_ISL) += isl
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr
@@ -71,6 +71,7 @@ $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compil
$(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
+$(curdir)/upx/compile := $(curdir)/ucl/compile
$(curdir)/zlib/compile := $(curdir)/cmake/compile
$(curdir)/zstd/compile := $(curdir)/cmake/compile
diff --git a/tools/ucl/Makefile b/tools/ucl/Makefile
new file mode 100644
index 0000000000..9fb9aec117
--- /dev/null
+++ b/tools/ucl/Makefile
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2019 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ucl
+PKG_VERSION:=1.03
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/ucl/download/$(PKG_SOURCE)
+PKG_HASH:=b865299ffd45d73412293369c9754b07637680e5c826915f097577cd27350348
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOSTCC :=gcc
+HOST_CFLAGS +=-std=gnu89
+
+define Host/Prepare
+ $(Host/Prepare/Default)
+ mkdir -p $(STAGING_DIR_HOST)/include/ucl
+endef
+
+define Host/Configure
+ (cd $(HOST_BUILD_DIR); \
+ CC="$(HOSTCC)" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ ./configure --prefix=$(STAGING_DIR_HOST) \
+ );
+ $(call Host/Configure/Default)
+endef
+
+define Host/Compile
+ $(MAKE) -C $(HOST_BUILD_DIR)
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
+define Host/Clean
+ $(MAKE) -C $(HOST_BUILD_DIR) uninstall
+ rm -rf $(HOST_BUILD_DIR)
+ rm -rf $(STAGING_DIR_HOST)/include/ucl
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/upx/Makefile b/tools/upx/Makefile
new file mode 100644
index 0000000000..fbf1dfbd2e
--- /dev/null
+++ b/tools/upx/Makefile
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2011-2020 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=upx
+PKG_VERSION:=3.95
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.xz
+PKG_SOURCE_URL:=https://github.com/upx/upx/releases/download/v$(PKG_VERSION)
+PKG_HASH:=3b0f55468d285c760fcf5ea865a070b27696393002712054c69ff40d8f7f5592
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+ UPX_UCLDIR=$(STAGING_DIR_HOST) \
+ $(MAKE) -C $(HOST_BUILD_DIR)/src \
+ CXXFLAGS_WERROR="" LDFLAGS="$(HOST_LDFLAGS)" \
+ CXX="$(HOSTCXX)"
+endef
+
+define Host/Install
+ $(CP) $(HOST_BUILD_DIR)/src/upx.out $(STAGING_DIR_HOST)/bin/upx
+endef
+
+define Host/Clean
+ rm -f $(STAGING_DIR_HOST)/bin/upx
+endef
+
+$(eval $(call HostBuild))
--
2.25.1