bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnulib on Windows (native / mingw32) / VMS / etc.


From: Bruno Haible
Subject: Re: Gnulib on Windows (native / mingw32) / VMS / etc.
Date: Wed, 16 May 2018 11:29:30 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

Paul Smith wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-04/msg00038.html>:
> first, GNU make provides a
> bootstrapping script that will let you compile make on systems which
> don't already have make... that means that I need to be able to build
> all these extra files without the assistance of automake (I do run
> configure).  I'm not sure how easy that will be.

To cope for this case, I would suggest to generate a "build all at once"
script from the generated Makefiles and config.status.
The user would then
  - run "./configure --disable-dependency-tracking"
  - execute the "build all at once" script generator,
  - execute the resulting script.

The output of "make -n" on the GNU make directory is quite simple.
In the case of make-4.2.1, it is:
$ make -n
[lots of automake junk]
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o ar.o 
ar.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
arscan.o arscan.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
commands.o commands.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
default.o default.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o dir.o 
dir.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
expand.o expand.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
file.o file.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
function.o function.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
getopt.o getopt.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
getopt1.o getopt1.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
guile.o guile.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
implicit.o implicit.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o job.o 
job.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
load.o load.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
loadapi.o loadapi.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
main.o main.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
misc.o misc.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
posixos.o posixos.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
output.o output.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
read.o read.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
remake.o remake.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
rule.o rule.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
signame.o signame.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
strcache.o strcache.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
variable.o variable.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
version.o version.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
vpath.o vpath.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
hash.o hash.c
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLIBDIR=\"/usr/local/lib\" 
-DINCLUDEDIR=\"/usr/local/include\" -DHAVE_CONFIG_H -I.      -g -O2 -c -o 
remote-stub.o remote-stub.c
rm -f make
gcc  -g -O2 -Wl,--export-dynamic  -o make ar.o arscan.o commands.o default.o 
dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o 
load.o loadapi.o main.o misc.o posixos.o output.o read.o remake.o rule.o 
signame.o strcache.o variable.o version.o vpath.o hash.o remote-stub.o    -ldl 
[a bit more of automake junk]

So really this job can be done in a shell script that
  - extracts the relevant file lists from config.status and the Makefiles
  - uses them to write out the gcc commands in a loop.

> More worrying, GNU make is compile-able on Windows and does not require
> Cygwin: it can be built using native MSVC and/or MingW32.  For
> bootstrapping GNU make provides a "build_w32.bat" file that compiles
> make using either gcc or MSVC.  In this setup I have a hard-coded
> config.h for Windows that I install since I don't run configure. 
> Making this work with the many packages added to lib seems complex.

This approach with "build_w32.bat" is outdated. The modern approach is
to use the Autoconf and Automake generated configure and Makefile.in
files without modifications.

More in detail: About ca. 10 years ago, Automake started to include
wrapper scripts (shell scripts) that make the MSVC compiler and archiver
('cl' and 'lib') be usable with the usual command-line options of a
'cc' and 'ar' program. From this point on, compilation for MSVC could
be done with just a Cygwin or MSYS build environment (that includes
bash, coreutils, grep, sed, and make).

The advantages for the package maintainer are big:
  - No more need to care about two different build systems
    (automake on one side, nmake on the other side).
  - No more need to write .bat files. Shell scripts are universally
    executable.
  - In some places, no more need to worry about slash vs. backslash
    as directory name separator.

The person who builds Windows binaries has more effort, though:
  - Need use install and get familiar with Cygwin or MSYS first.
  - Build times are higher, because of the wrapper script invocations
    (but this is mitigated by the faster machines that we have today).

This approach is described in detail in
  http://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=INSTALL.windows

You can copy this file literally to other packages (I use the same file in
gperf, gettext, libunistring, libffcall, etc.).

> Finally, GNU make can also be compiled on other less common
> architectures, such as VMS and these ports are quite active.

I would suggest that these maintainers of these ports follow the approach
described above for Windows:
  - Package a build environment with bash, grep, sed, make, that can be
    easily installed.
  - Create wrapper scripts for 'cc' and 'ar'.

Really, no one has time to maintain a 'Makefile.vms' like I did for some
time for GNU gperf:
http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=blob;f=Makefile.vms

You really want to reduce the number of redundant Makefiles you have to
maintain to 1, as soon as possible.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]