-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.winlib
209 lines (200 loc) · 12.2 KB
/
make.winlib
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
198
199
200
201
202
203
204
205
206
207
208
209
#export NAME="GNU Make"
#export STATUS=
#export URL=http://www.gnu.org/software/make/
#export BASENAME=make
#export DESCRIPTION="Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files."
#export CATEGORY=development
#export TYPE=application
##export VERSION=3.81
##export VERSIONDATE=20110729
##export VERSION=3.82
##export VERSIONDATE=20110729
#####'fail' is not recognized as an internal or external command, operable program or batch file.
##export VERSION=4.0
##export VERSIONDATE=20130910
##export VERSION=4.1
##export VERSIONDATE=20141006
##export VERSION=4.2
##export VERSIONDATE=20160523
##export VERSION=4.2.1
##export VERSIONDATE=20160611
##export VERSION=4.3
##export VERSIONDATE=20200120
##export VERSION=4.4
##export VERSIONDATE=20221031
#export VERSION=4.4.1
#export VERSIONDATE=20230227
#wl-showstatus --package-version
##export DEPENDENCIES=libiconv
#export DEPENDENCIES=libiconv,gettext,sys_wait_h
#export OPTIONALDEPENDENCIES=
#export BUILDDEPENDENCIES=
#export OPTIONALBUILDDEPENDENCIES=
#export LICENSEFILE=COPYING
#export LICENSETYPE=GPL
#export DOWNLOADURL="http://ftp.gnu.org/gnu/make/"
#export INSTALLPREFIX=`pwd`/inst_$BASENAME-$VERSION
##export DOWNLOADSOURCEURL=http://ftp.gnu.org/gnu/make/$BASENAME-$VERSION.tar.bz2
#export DOWNLOADSOURCEURL=http://ftp.gnu.org/gnu/make/$BASENAME-$VERSION.tar.gz
#wl-showstatus download
#wl-download -v -d $TARBALLDIR/$BASENAME $DOWNLOADSOURCEURL
#wl-wait4deps
##tar xj --force-local -f $TARBALLDIR/$BASENAME/$BASENAME-$VERSION.tar.bz2
#tar xz --force-local -f $TARBALLDIR/$BASENAME/$BASENAME-$VERSION.tar.gz
#cd $BASENAME-$VERSION
## fix redefinition of WAIT_NOHANG in job.c (version >= 4.2.1)
#patch -ulbf job.c << EOF
#@@ -126,2 +126,3 @@
# #ifdef HAVE_WAITPID
#+# undef WAIT_NOHANG
# # define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG)
#EOF
## fix src/output.h for MinGW (version >= 4.3)
#patch -ulbf src/output.h << EOF
#@@ -69,4 +69,4 @@
# /* For emulations in w32/compat/posixfcn.c. */
#-# define F_GETFD 1
#-# define F_SETLKW 2
#+# define F_GETFD 2
#+# define F_SETLKW 3
# /* Implementation note: None of the values of l_type below can be zero
#@@ -91,2 +91,3 @@
# /* Public functions emulated/provided in posixfcn.c. */
#+#define fcntl MAKE_fcntl
# int fcntl (intptr_t fd, int cmd, ...);
#EOF
## fix src/w32/compat/dirent.c for MinGW (version >= 4.3)
#mv src/w32/compat/dirent.c src/w32/compat/dirent.c.bak &&
#echo "#ifndef __MINGW32__" > src/w32/compat/dirent.c &&
#cat src/w32/compat/dirent.c.bak >> src/w32/compat/dirent.c &&
#echo "#endif" >> src/w32/compat/dirent.c
## fix bad timestamps in src/remake.c (version >= 4.4)
##### see also: https://github.com/msys2/MINGW-packages/pull/13834
##### see also: https://lists.gnu.org/archive/html/bug-make/2022-11/msg00020.html
#patch -ulbf src/remake.c << EOF
#@@ -39,3 +39,3 @@
# #include <sys/stat.h>
#-#if defined(_MSC_VER) && _MSC_VER > 1200
#+#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER > 1200)
# /* VC7 or later supprots _stat64 to access 64-bit file size. */
#EOF
## also support triplet ending with mingw32ucrt (version >= 4.3)
#sed -i.bak -e "s/\(mingw32\))/\1*)/" configure
#wl-showstatus configure &&
# #./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --enable-case-insensitive-file-system &&
# #./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --disable-rpath --enable-case-insensitive-file-system --enable-job-server &&
# #./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --without-guile --enable-case-insensitive-file-system &&
# #./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --without-guile --enable-case-insensitive-file-system CFLAGS="-I$MINGWPREFIX/win32ports/include" &&
# #./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --without-dmalloc CFLAGS="-I$MINGWPREFIX/win32ports/include" &&
# ./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --without-dmalloc CFLAGS="-I$MINGWPREFIX/win32ports/include -I$MINGWPREFIX/include/mman-win32 $(if echo $RUNPLATFORM | grep -q "^i.86"; then echo "-march=pentium4 -mtune=generic -O2"; fi) $(if echo $RUNPLATFORM | grep -q "^x86_64"; then echo "-march=nocona -msahf -mtune=generic -O2"; fi)" LDFLAGS="-Wl,--no-insert-timestamp" &&
# ## fix missing waitpid (and pipe) (version <= 4.2.1)
# #echo "#if defined(HAVE_SYS_WAIT_H) && !defined(HAVE_WAITPID)" >> config.h &&
# #echo "#define HAVE_WAITPID 1" >> config.h &&
# #echo "/*#define HAVE_PIPE 1*/" >> config.h &&
# #echo "#endif" >> config.h &&
# ## fix missing realpath (version <= 4.2.1)
# #echo "#if !defined(HAVE_REALPATH) && !defined(realpath)" >> config.h &&
# #echo "#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)" >> config.h &&
# #echo "#define HAVE_REALPATH 1" >> config.h &&
# #echo "#endif" >> config.h &&
# # fix missing realpath (version >= 4.3)
# echo '#if !defined(HAVE_REALPATH) && !defined(realpath)' >> src/config.h &&
# echo "#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)" >> src/config.h &&
# echo "#define HAVE_REALPATH 1" >> src/config.h &&
# echo "#endif" >> src/config.h &&
# echo "#undef HAVE_SYS_WAIT_H" >> src/config.h &&
# ## fix missing pipe (version >= 4.3)
# #echo "#ifndef HAVE_PIPE" >> src/config.h &&
# #echo "#define pipe(fds) _pipe(fds, 512, _O_BINARY)" >> src/config.h &&
# #echo "#define HAVE_PIPE 1" >> src/config.h &&
# #echo "#endif" >> src/config.h &&
# wl-showstatus build-install &&
# #( make install-strip || make install || /bin/make install || C_INCLUDE_PATH=$MINGWPREFIX/win32ports/include${C_INCLUDE_PATH:+:$C_INCLUDE_PATH} mingw32-make.exe install ) &&
# ( make install-strip CFLAGS="-O2" || make install CFLAGS="-O2" || /bin/make install CFLAGS="-O2" || C_INCLUDE_PATH=$MINGWPREFIX/win32ports/include${C_INCLUDE_PATH:+:$C_INCLUDE_PATH} mingw32-make.exe install CFLAGS="-O2" ) &&
# strip $INSTALLPREFIX/share/make/bin/*.exe &&
# wl-makepackage -c -d && wl-install -d $BASENAME-$VERSION && cd .. && rm -rf $BASENAME-$VERSION
export NAME="GNU Make"
export STATUS=
export URL=http://www.gnu.org/software/make/
export BASENAME=make
export DESCRIPTION="Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files."
export CATEGORY=development
export TYPE=application
export VERSION=4.4.1
export VERSIONDATE=20230227
wl-showstatus --package-version
#export DEPENDENCIES=libiconv,gettext,libdl,sys_wait_h
export DEPENDENCIES=libiconv,gettext,sys_wait_h
export OPTIONALDEPENDENCIES=
export BUILDDEPENDENCIES=
export OPTIONALBUILDDEPENDENCIES=
export LICENSEFILE=COPYING
export LICENSETYPE=GPL
#export DOWNLOADURL="http://ftp.gnu.org/gnu/make/"
export DOWNLOADURL="https://ftp.gnu.org/gnu/make/"
export INSTALLPREFIX=`pwd`/inst_$BASENAME-$VERSION
#export DOWNLOADSOURCEURL=http://ftp.gnu.org/gnu/make/$BASENAME-$VERSION.tar.gz
export DOWNLOADSOURCEURL=https://ftp.gnu.org/gnu/make/$BASENAME-$VERSION.tar.gz
wl-showstatus download
wl-download -v -d $TARBALLDIR/$BASENAME $DOWNLOADSOURCEURL
wl-wait4deps
tar xz --force-local -f $TARBALLDIR/$BASENAME/$BASENAME-$VERSION.tar.gz
cd $BASENAME-$VERSION
# fix timestamp issue in src/remake.c (version >= 4.4.1)
patch -ulbf src/remake.c << EOF
@@ -39,3 +39,3 @@
#include <sys/stat.h>
-#if defined(_MSC_VER) && _MSC_VER > 1200
+#if (defined(_MSC_VER) && _MSC_VER > 1200) || defined(__MINGW32__)
/* VC7 or later supports _stat64 to access 64-bit file size. */
EOF
# fix GCC15 build issue in lib/fnmatch.c (version >= 4.4.1)
patch -ulbf lib/fnmatch.c << EOF
@@ -122,3 +122,3 @@
-# if !defined _LIBC && !defined getenv
+# if !defined _LIBC && !defined getenv && !defined(__MINGW32__)
extern char *getenv ();
EOF
# fix GCC15 build issue in src/getopt.c (version >= 4.4.1)
patch -ulbf src/getopt.c << EOF
@@ -68,2 +68,4 @@
# include <unistd.h>
+#elif defined(__MINGW32__)
+# include <stdlib.h>
#endif /* GNU C library. */
@@ -203,3 +205,3 @@
-#ifndef getenv
+#if !defined(getenv) && !defined(__MINGW32__)
extern char *getenv ();
EOF
# fix GCC15 build issue in src/getopt.h (version >= 4.4.1)
patch -ulbf src/getopt.h << EOF
@@ -103,3 +103,3 @@
extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
+#elsif !defined(__MINGW32__) /* not __GNU_LIBRARY__ */
extern int getopt ();
EOF
# fix GCC15 build issue in src/job.c (version >= 4.4.1)
patch -ulbf src/job.c << EOF
@@ -146,3 +146,3 @@
-#if !defined (wait) && !defined (POSIX)
+#if !defined (wait) && !defined (POSIX) && !defined(__MINGW32__)
int wait ();
EOF
# also support triplet ending with mingw32ucrt (version >= 4.3)
sed -i.bak -e "s/\(mingw32\))/\1*)/" configure
wl-showstatus configure &&
#./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --enable-load --without-dmalloc --disable-rpath CFLAGS="-I$MINGWPREFIX/win32ports/include -I$MINGWPREFIX/include/libdl-win32 -O2 $(if echo $RUNPLATFORM | grep -q "^i.86"; then echo "-march=pentium4 -mtune=generic"; fi) $(if echo $RUNPLATFORM | grep -q "^x86_64"; then echo "-march=nocona -msahf -mtune=generic"; fi)" LDFLAGS="-Wl,--no-insert-timestamp -Wl,--as-needed -ldl" &&
#./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --enable-load --without-dmalloc --disable-rpath CFLAGS="-I$MINGWPREFIX/win32ports/include -O2 $(if echo $RUNPLATFORM | grep -q "^i.86"; then echo "-march=pentium4 -mtune=generic"; fi) $(if echo $RUNPLATFORM | grep -q "^x86_64"; then echo "-march=nocona -msahf -mtune=generic"; fi)" LDFLAGS="-Wl,--no-insert-timestamp" &&
#./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --enable-load --without-dmalloc --disable-rpath CFLAGS="-D__USE_MINGW_ANSI_STDIO=0 -I$MINGWPREFIX/win32ports/include -O2 $(if echo $RUNPLATFORM | grep -q "^i.86"; then echo "-march=pentium4 -mtune=generic"; fi) $(if echo $RUNPLATFORM | grep -q "^x86_64"; then echo "-march=nocona -msahf -mtune=generic"; fi)" LDFLAGS="-Wl,--no-insert-timestamp" &&
./configure --prefix=$INSTALLPREFIX/share/make --build=$BUILDPLATFORM --host=$RUNPLATFORM --program-prefix=mingw32- --enable-job-server --enable-load --enable-cross-guesses=conservative --without-guile --enable-case-insensitive-file-system --disable-posix-spawn --enable-load --without-dmalloc --disable-rpath $(if echo $RUNPLATFORM|grep -vq "^i.86"; then echo "--enable-year2038"; fi) CFLAGS="-D__USE_MINGW_ANSI_STDIO=0 -I$MINGWPREFIX/win32ports/include -O2 $(if echo $RUNPLATFORM | grep -q "^i.86"; then echo "-march=pentium4 -mtune=generic"; fi) $(if echo $RUNPLATFORM | grep -q "^x86_64"; then echo "-march=nocona -msahf -mtune=generic"; fi)" &&
# enable sys/wait.h (version >= 4.4.1)
echo "#undef HAVE_SYS_WAIT_H" >> src/config.h &&
echo "#define HAVE_SYS_WAIT_H 1" >> src/config.h &&
# avoid storing absolute path specified by CXX environment variable
sed -i.bak -e "s?^\(#define MAKE_[^ ]* \"\)[^\"]*/?\1?p" src/config.h &&
wl-showstatus build-install &&
( mingw32-make install-strip || make install-strip ) &&
strip $INSTALLPREFIX/share/make/bin/*.exe &&
wl-makepackage -c -d && wl-install -d $BASENAME-$VERSION && cd .. && rm -rf $BASENAME-$VERSION