package/libs/zlib: Add option for O3 optimization
authorDaniel Engberg <daniel.engberg.lists@pyret.net>
Tue, 5 Sep 2017 17:31:10 +0000 (19:31 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Tue, 2 Jan 2018 16:11:12 +0000 (17:11 +0100)
Add option to use O3 optimization as not all devices have
space constraints. This option is default using GCC in upstream
but isn't in the CMake makefile for some reason.

Source: https://github.com/madler/zlib/blob/master/configure#L170

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
package/libs/zlib/Config.in [new file with mode: 0644]
package/libs/zlib/Makefile

diff --git a/package/libs/zlib/Config.in b/package/libs/zlib/Config.in
new file mode 100644 (file)
index 0000000..64b835e
--- /dev/null
@@ -0,0 +1,11 @@
+menu "Configuration"
+       depends on PACKAGE_zlib
+
+config ZLIB_OPTIMIZE_SPEED
+       bool "Optimize for speed"
+       help
+               This enables additional optimization and 
+               increases performance considerably at 
+               the expense of binary size.
+
+endmenu
index 3602e629cf4a9ec2029acd8adb49a782e69f1fc2..2650faa139b0aeb412ef78f7a627758904c85d66 100644 (file)
@@ -19,6 +19,8 @@ PKG_LICENSE:=Zlib
 PKG_LICENSE_FILES:=README
 PKG_CPE_ID:=cpe:/a:gnu:zlib
 
+PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
@@ -47,8 +49,16 @@ define Package/zlib-dev/description
  This package includes the development support files.
 endef
 
+define Package/zlib/config
+       source "$(SOURCE)/Config.in"
+endef
+
 TARGET_CFLAGS += $(FPIC)
 
+ifeq ($(CONFIG_ZLIB_OPTIMIZE_SPEED),y)
+       TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
+endif
+
 ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
        CMAKE_OPTIONS += \
                -DARMv8=ON