package/libs/zlib: Add ARM and NEON optimizations
[oweals/openwrt.git] / package / libs / zlib / Makefile
1 #
2 # Copyright (C) 2006-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=zlib
11 PKG_VERSION:=1.2.11
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
16 PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
17
18 PKG_LICENSE:=Zlib
19 PKG_LICENSE_FILES:=README
20 PKG_CPE_ID:=cpe:/a:gnu:zlib
21
22 include $(INCLUDE_DIR)/package.mk
23 include $(INCLUDE_DIR)/cmake.mk
24
25 define Package/zlib
26   SECTION:=libs
27   CATEGORY:=Libraries
28   TITLE:=Library implementing the deflate compression method
29   URL:=http://www.zlib.net/
30 endef
31
32 define Package/zlib-dev
33   SECTION:=devel
34   CATEGORY:=Development
35   SUBMENU:=Libraries
36   DEPENDS:=zlib
37   TITLE:=Development files for the zlib library
38 endef
39
40 define Package/zlib/description
41  zlib is a lossless data-compression library.
42  This package includes the shared library.
43 endef
44
45 define Package/zlib-dev/description
46  zlib is a lossless data-compression library.
47  This package includes the development support files.
48 endef
49
50 TARGET_CFLAGS += $(FPIC)
51
52 ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
53         CMAKE_OPTIONS += \
54                 -DARMv8=ON
55 endif
56
57 define Build/InstallDev
58         mkdir -p $(1)/usr/include
59         $(CP)   $(PKG_INSTALL_DIR)/usr/include/z{conf,lib}.h \
60                 $(1)/usr/include/
61         mkdir -p $(1)/usr/lib
62         $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libz.{a,so*} \
63                 $(1)/usr/lib/
64         mkdir -p $(1)/usr/lib/pkgconfig
65         $(CP)   $(PKG_INSTALL_DIR)/usr/share/pkgconfig/zlib.pc \
66                 $(1)/usr/lib/pkgconfig/
67 endef
68
69 # libz.so is needed for openssl (zlib-dynamic)
70 define Package/zlib/install
71         $(INSTALL_DIR) $(1)/usr/lib
72         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so $(1)/usr/lib/
73         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so.* $(1)/usr/lib/
74 endef
75
76 define Package/zlib-dev/install
77         $(INSTALL_DIR) $(1)/usr/include
78         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/zconf.h \
79           $(1)/usr/include/
80         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/zlib.h \
81           $(1)/usr/include/
82         $(INSTALL_DIR) $(1)/usr/lib
83         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.a $(1)/usr/lib/
84         $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
85         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/zlib.pc \
86           $(1)/usr/lib/pkgconfig/
87 endef
88
89 $(eval $(call BuildPackage,zlib))
90 $(eval $(call BuildPackage,zlib-dev))