c61bf527aea7c8529ee8f80346d3787e692ac106
[feed/packages.git] / libs / nspr / Makefile
1 #
2 # Copyright (C) 2019 Lucian Cristian
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=nspr
10 PKG_VERSION:=4.35
11 PKG_RELEASE:=2
12 PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
13 PKG_LICENCE:=MPL-2.0
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:= \
17 https://download.cdn.mozilla.net/pub/$(PKG_NAME)/releases/v$(PKG_VERSION)/src/ \
18 https://archive.mozilla.org/pub/$(PKG_NAME)/releases/v$(PKG_VERSION)/src/
19 PKG_HASH:=7ea3297ea5969b5d25a5dd8d47f2443cda88e9ee746301f6e1e1426f8a6abc8f
20
21 PKG_BUILD_PARALLEL:=1
22 PKG_INSTALL:=1
23 PKG_FIXUP:=autoreconf
24 PKG_BUILD_FLAGS:=lto
25
26 include $(INCLUDE_DIR)/package.mk
27
28 CONFIGURE_PATH = ./nspr
29 MAKE_PATH = ./nspr
30 PKG_AUTOMAKE_PATHS = $(PKG_BUILD_DIR)/nspr
31 LBITS = $(shell $(TARGET_CC) -dM -E - </dev/null | grep -q "__LP64__" && echo 64 || echo 32)
32
33 ifeq ($(LBITS),64)
34 conf=--enable-64bit
35 endif
36
37 export MUSL=$(if $(CONFIG_LIBC_USE_GLIBC),0,1)
38 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed $(FPIC)
39 ifneq ($(CONFIG_USE_MUSL),)
40 TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
41 endif
42
43 CONFIGURE_ARGS += \
44 --build=$(GNU_HOST_NAME) \
45 --host=$(GNU_HOST_NAME) \
46 --target=$(REAL_GNU_TARGET_NAME) \
47 --disable-debug \
48 --with-pthreads \
49 $(if $(CONFIG_IPV6),--enable-ipv6,--disable-ipv6) \
50 $(conf)
51
52 define Build/Compile
53 CROSS_COMPILE=1 CFLAGS="-DXP_UNIX $(HOST_CFLAGS)" LDFLAGS="" CC="$(HOSTCC)" \
54 $(MAKE) -C $(PKG_BUILD_DIR)/nspr/config
55 $(call Build/Compile/Default)
56 endef
57
58 define Package/nspr
59 SECTION:=libs
60 CATEGORY:=Libraries
61 TITLE:=Netscape Portable Runtime (NSPR)
62 URL:=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR
63 DEPENDS:=+libpthread
64 endef
65
66 define Package/nspr/description
67 Netscape Portable Runtime (NSPR) provides a platform-neutral API for system
68 level and libc-like functions. The API is used in the Mozilla clients, many
69 of Red Hat's and Oracle's server applications, and other software offerings.
70 endef
71
72 define Build/InstallDev
73 $(INSTALL_DIR) \
74 $(1)/usr/include \
75 $(1)/usr/lib/ \
76 $(1)/usr/lib/pkgconfig/ \
77 $(1)/usr/share/aclocal/
78
79 $(CP) $(PKG_INSTALL_DIR)/usr/include/nspr $(1)/usr/include/
80 $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
81 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
82 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/* $(1)/usr/share/aclocal/
83 endef
84
85 define Package/nspr/install
86 $(INSTALL_DIR) $(1)/usr/lib
87 $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib/
88 endef
89
90 $(eval $(call BuildPackage,nspr))