Browse Source

erlang: fix musl compatibility

gethostbyname_r is available when _GNU_SOURCE is defined, add a patch to check for it instead of __GLIBC__, build with -D_GNU_SOURCE, bump release number

Signed-off-by: Nicolas Thill <nico@openwrt.org>
Nicolas Thill 9 years ago
parent
commit
d4afd14ff1
2 changed files with 15 additions and 1 deletions
  1. 4
    1
      lang/erlang/Makefile
  2. 11
    0
      lang/erlang/patches/102-musl_compat.patch

+ 4
- 1
lang/erlang/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=erlang
11 11
 PKG_VERSION:=17.5
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz
15 15
 PKG_SOURCE_URL:= http://www.erlang.org/download/ \
@@ -232,6 +232,8 @@ HOST_CONFIGURE_ARGS += \
232 232
 	--disable-smp-support \
233 233
 	--without-javac
234 234
 
235
+HOST_CFLAGS += -D_GNU_SOURCE
236
+
235 237
 define Host/Compile
236 238
 	$(MAKE) -C $(HOST_BUILD_DIR) all
237 239
 endef
@@ -257,6 +259,7 @@ CONFIGURE_VARS += \
257 259
 	erl_xcomp_getaddrinfo=no \
258 260
 	erl_xcomp_sysroot="$(STAGING_DIR)"
259 261
 
262
+EXTRA_CFLAGS+=-D_GNU_SOURCE
260 263
 EXTRA_LDFLAGS+=-lz
261 264
 
262 265
 define Build/Compile

+ 11
- 0
lang/erlang/patches/102-musl_compat.patch View File

@@ -0,0 +1,11 @@
1
+--- a/lib/erl_interface/src/connect/ei_resolve.c
2
++++ b/lib/erl_interface/src/connect/ei_resolve.c
3
+@@ -642,7 +642,7 @@ struct hostent *ei_gethostbyname_r(const
4
+ #ifndef HAVE_GETHOSTBYNAME_R
5
+   return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop);
6
+ #else
7
+-#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__))
8
++#if (defined(_GNU_SOURCE) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__))
9
+   struct hostent *result;
10
+ 
11
+   gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop);