Package: erlang / 1:28.0.2+dfsg-1

gnu.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Author: Aurelien Jarno <aurel32@debian.org>
Author: Sergei Golovan <sgolovan@debian.org>
Author: Pino Toscano <pino@debian.org>

(1) Defines GNU macros not only for Linux but also for any system
    with 'gnu' substring in OS name. Fixes FTBFS on GNU/kFreeBSD and GNU/Hurd.

(2) Undefines BSD4_4 for os_mon application for GNU/Hurd;

(3) Undefines AF_LINK for GNU/Hurd;

(4) Switches some PATH_MAX occurrences to MAXPATHLEN;

(5) Adds a workaround for 'erlc -M | sed' being stuck for GNU/Hurd.

--- a/erts/configure.ac
+++ b/erts/configure.ac
@@ -523,7 +523,7 @@
 
 dnl NOTE: CPPFLAGS will be included in CFLAGS at the end
 case $host_os in
-    linux*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";; 
+    linux*|*gnu*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";; 
     aix*|os400*)
         # * _ALL_SOURCE: Required to get the winsize structure for TIOCSWINSZ.
         # * _LINUX_SOURCE_COMPAT: Not required, but makes some libc functions
@@ -1157,7 +1157,7 @@
 fi
 
 case $host_os in
-    linux*)
+    linux*|*gnu*)
 	AC_MSG_CHECKING([whether dlopen() needs to be called before first call to dlerror()])
 	if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then
 	    AC_DEFINE(ERTS_NEED_DLOPEN_BEFORE_DLERROR,[1],
--- a/lib/os_mon/c_src/memsup.c
+++ b/lib/os_mon/c_src/memsup.c
@@ -101,6 +101,11 @@
 #include <time.h>
 #include <errno.h>
 
+#ifdef __GNU__
+#warning "Undefined BSD4_4 for GNU/Hurd"
+#undef BSD4_4
+#endif
+
 #ifdef BSD4_4
 #include <sys/types.h>
 #include <sys/sysctl.h>
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -5327,6 +5327,11 @@
     *x = addr;
     return 0;
 }
+#ifdef __GNU__
+#warning "Undefined AF_LINK for GNU/Hurd"
+#undef AF_LINK
+#endif
+
 
 #endif
 
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -1710,7 +1710,7 @@
     if (!bindir) {
 	/* Determine bindir from absolute path to executable */
 	char *p;
-	char buffer[PATH_MAX];
+	char buffer[MAXPATHLEN];
 	strncpy(buffer, argv[0], sizeof(buffer));
 	buffer[sizeof(buffer)-1] = '\0';
 	
@@ -1724,7 +1724,7 @@
     if (!rootdir) {
 	/* Determine rootdir from absolute path to bindir */
 	char *p;
-	char buffer[PATH_MAX];
+	char buffer[MAXPATHLEN];
 	strncpy(buffer, bindir, sizeof(buffer));
 	buffer[sizeof(buffer)-1] = '\0';
 	
@@ -1958,7 +1958,7 @@
         char cwd[MAX_PATH];
         if (_getcwd(cwd, sizeof(cwd)) == NULL) {
 #else
-        char cwd[PATH_MAX];
+        char cwd[MAXPATHLEN];
         if (getcwd(cwd, sizeof(cwd)) == NULL) {
 #endif
             cwd[0] = '\0';
--- a/erts/etc/common/escript.c
+++ b/erts/etc/common/escript.c
@@ -49,7 +49,7 @@
 #  define IS_DIRSEP(c) ((c) == '/')
 #  define DIRSEPSTR "/"
 #  define PATHSEPSTR ":"
-#  define PMAX PATH_MAX
+#  define PMAX MAXPATHLEN
 #  define ERL_NAME "erl"
 #endif
 
--- a/erts/etc/unix/dyn_erl.c
+++ b/erts/etc/unix/dyn_erl.c
@@ -146,8 +146,8 @@
 static char *
 find_prog(char *origpath)
 {
-    char relpath[PATH_MAX];
-    char abspath[PATH_MAX];
+    char relpath[MAXPATHLEN];
+    char abspath[MAXPATHLEN];
 
     strcpy(relpath, origpath);
 
@@ -158,7 +158,7 @@
         envpath = get_env("PATH");
         if (envpath) {
             /* Try to find the executable in the path */
-            char dir[PATH_MAX];
+            char dir[MAXPATHLEN];
             char *beg = envpath;
             char *end;
             int sz;
@@ -277,7 +277,7 @@
     /* List install dir and look for latest erts-vsn */
     DIR *dp;                    /* Pointer to directory structure. */
     struct dirent* dirp;        /* Pointer to directory entry.     */
-    char latest_vsn[PATH_MAX];  /* Latest erts-vsn directory name. */
+    char latest_vsn[MAXPATHLEN];/* Latest erts-vsn directory name. */
 
     dp = opendir(erl_top);
     if (dp == NULL) {
@@ -317,7 +317,7 @@
 
     char *p;
     char *p2;
-    char buffer[PATH_MAX];
+    char buffer[MAXPATHLEN];
 
     strcpy(buffer, erlpath);
 
@@ -360,9 +360,9 @@
     char *p;
     char *abspath;
     char *bindir;            /* Location of executables. */
-    char rootdir[PATH_MAX];  /* Root location of Erlang installation. */
-    char progname[PATH_MAX]; /* Name of this program. */
-    char erlexec[PATH_MAX];  /* Path to erlexec */
+    char rootdir[MAXPATHLEN];/* Root location of Erlang installation. */
+    char progname[MAXPATHLEN];/* Name of this program. */
+    char erlexec[MAXPATHLEN];/* Path to erlexec */
 
     if (argc == 2 && strcmp(argv[1], "--realpath") == 0) {
         abspath = find_prog(argv[0]);
--- a/lib/ssl/src/Makefile
+++ b/lib/ssl/src/Makefile
@@ -192,7 +192,8 @@
 
 $(DEP_FILE): $(ERL_FILES)
 	@echo SED $(TARGET) $(ERL_TOP_NATIVE)
-	$(gen_verbose)erlc -M $(ERL_FILES) \
+	$(gen_verbose)erlc -M $(ERL_FILES) > $(DEP_FILE).tmp
+	cat $(DEP_FILE).tmp \
 	| perl -pe "s@ [a-zA-Z]?$(ERL_TOP_NATIVE)/(?:bootstrap/)?lib/([^/]+)@ ../../\1@g" 2> /dev/null \
 	| sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \
 	| sed 's@^dtls_@$$(EBIN)/dtls_@' \
--- a/make/autoconf/otp.m4
+++ b/make/autoconf/otp.m4
@@ -1889,6 +1889,8 @@
 		    ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGALTSTACK"
 		fi
 		;;
+	    *gnu*)
+		ETHR_DEFS="$ETHR_DEFS -D_GNU_SOURCE" ;;
 	    *) ;;
 	esac
 
@@ -3283,7 +3285,7 @@
 DED_OSTYPE=unix
 
 case $host_os in
-     linux*)
+     linux*|*gnu*)
 	DED_CFLAGS="-D_GNU_SOURCE" ;;
      win32)
 	DED_CFLAGS="-D_WIN32_WINNT=0x0600 -DWINVER=0x0600"
@@ -3417,7 +3419,7 @@
 		fi
 		DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
 	;;
-	linux*)
+	linux*|*gnu*)
 		DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
 		DED_LDFLAGS="-shared -Wl,-Bsymbolic"
 		if test X${enable_m64_build} = Xyes; then