Skip to content

Commit

Permalink
package/libs/zlib: Add option for O3 optimization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
diizzyy authored and jollaman999 committed Jan 13, 2018
1 parent 5bc700c commit caf5a51
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions package/libs/zlib/Config.in
@@ -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
10 changes: 10 additions & 0 deletions package/libs/zlib/Makefile
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit caf5a51

Please sign in to comment.