Merge pull request #19372 from cotequeiroz/libgd
[feed/packages.git] / libs / libgd / Makefile
1 #
2 # Copyright (C) 2006-2015 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:=libgd
11 PKG_VERSION:=2.3.2
12 PKG_RELEASE:=$(AUTORELEASE)
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=https://github.com/$(PKG_NAME)/$(PKG_NAME)/releases/download/gd-$(PKG_VERSION)/
16 PKG_HASH:=478a047084e0d89b83616e4c2cf3c9438175fb0cc55d8c8967f06e0427f7d7fb
17
18 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
19 PKG_LICENSE:=MIT
20 PKG_LICENSE_FILES:=COPYING
21 PKG_CPE_ID:=cpe:/a:libgd:libgd
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/cmake.mk
25
26 define Package/libgd/default
27 SECTION:=libs
28 CATEGORY:=Libraries
29 DEPENDS:=+libjpeg +libpng +libwebp
30 TITLE:=The GD graphics library
31 URL:=https://libgd.github.io/
32 endef
33
34 define Package/libgd
35 $(call Package/libgd/default)
36 MENU:=1
37 DEPENDS+=+LIBGD_TIFF:libtiff +LIBGD_FREETYPE:libfreetype
38 VARIANT:=default
39 CONFLICTS:=libgd-full
40 endef
41
42 define Package/libgd-full
43 $(call Package/libgd/default)
44 DEPENDS+=+libtiff +libfreetype
45 TITLE+=(full)
46 VARIANT:=full
47 PROVIDES:=libgd
48 endef
49
50 define Package/libgd/description/default
51 GD is an open source code library for the dynamic creation of images by
52 programmers. GD creates PNG, JPEG and GIF images, among other formats.
53 endef
54
55 Package/libgd/description=$(Package/libgd/description/default)
56
57 define Package/libgd-full/description
58 $(call Package/libgd/description/default)
59 .
60 This variant of the libgd package is compiled will all features enabled.
61 endef
62
63 define Package/libgd/config
64 if PACKAGE_libgd
65 config LIBGD_TIFF
66 bool "TIFF image support"
67 default n
68 help
69 Enable TIFF image support through libtiff
70 endif
71 if PACKAGE_libgd
72 config LIBGD_FREETYPE
73 bool "Freetype 2.x library support"
74 default n
75 help
76 Enable Freetype 2.x font engine support through libfreetype
77 endif
78 endef
79
80 TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections -flto
81
82 CMAKE_OPTIONS += \
83 -DENABLE_FONTCONFIG=OFF \
84 -DENABLE_ICONV=OFF \
85 -DENABLE_JPEG=ON \
86 -DENABLE_LIQ=OFF \
87 -DENABLE_PNG=ON \
88 -DENABLE_TIFF=$(if $(CONFIG_LIBGD_TIFF),ON,OFF) \
89 -DENABLE_WEBP=ON \
90 -DENABLE_XPM=OFF \
91 -DZLIB_INCLUDE_DIR="$(STAGING_DIR)/usr"
92
93 ifeq ($(BUILD_VARIANT),full)
94 CMAKE_OPTIONS += \
95 -DENABLE_TIFF=ON \
96 -DFREETYPE_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/freetype2/ \
97 -DENABLE_FREETYPE=ON
98
99 else
100
101 ifdef CONFIG_LIBGD_FREETYPE
102 CMAKE_OPTIONS += \
103 -DFREETYPE_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/freetype2/ \
104 -DENABLE_FREETYPE=ON
105 else
106 CMAKE_OPTIONS += \
107 -DENABLE_FREETYPE=OFF
108 endif
109
110 endif
111
112 define Build/InstallDev
113 $(call Build/InstallDev/cmake,$(1))
114 $(SED) 's,/usr/lib,$(STAGING_DIR)/usr/lib,g' $(1)/usr/lib/pkgconfig/gdlib.pc
115 $(SED) 's,/usr/include,$(STAGING_DIR)/include,g' $(1)/usr/lib/pkgconfig/gdlib.pc
116 endef
117
118 define Package/libgd/install
119 $(INSTALL_DIR) $(1)/usr/lib
120 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgd.so* $(1)/usr/lib/
121 endef
122
123 Package/libgd-full/install=$(Package/libgd/install)
124
125 $(eval $(call BuildPackage,libgd))
126 $(eval $(call BuildPackage,libgd-full))