New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile.mk: portable Makefile.m32 #9764
Conversation
Details to produce an Amiga OS build without compiler and linker errors: export CROSSPREFIX=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-
export CC=gcc
export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H'
export CFLAGS='-mcrt=clib2'
export LDFLAGS="${CFLAGS}"
export LIBS='-lnet -lm'
make -C lib -f Makefile.mk
make -C src -f Makefile.mk Warnings remaining:
|
801f29a
to
0c7c999
Compare
3e438c3
to
7e1dd3b
Compare
This PR is ready at this point. Comments are welcome! My main question is if we're fundamentally okay with merging MS-DOS, Amiga and MinGW standalone Makefiles into one. IMO this makes things cleaner and simpler to maintain, but it will unavoidably affect DJGPP and Amiga users who used the standalone Makefiles. In those cases the configuration will need to be changed. This isn't terribily complicated and there should be no loss in functionality, but it needs to be done nevertheless, and there is a non-zero chance for fallouts. On the other hand it reduces the number of distinct build methods. It also makes testing MS-DOS and Amiga builds simpler, as they now align perfectly with the MinGW (standalone = m32) ones. |
I'm fine with this, though I see hardly any documentation changes. Shouldn't there be a notice or a section for Amiga or MS-DOS users that build this way, to let them know of the new makefile? |
@jay: Yes, that would be a nice touch. Though Amiga did not have an entry in [ Also fixed for msdos and amiga so that |
lgtm. @gvanem what do you think? |
Details to produce MS-DOS binaries (from a *NIX env): Get dev env: cd /opt
# For other platforms, see: https://github.com/andrewwutw/build-djgpp
curl -L https://github.com/andrewwutw/build-djgpp/releases/download/v3.3/djgpp-osx-gcc1210.tar.bz2 | tar -x
(
cd djgpp
curl -LO https://mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2tk/wat3211b.zip
curl -LO https://mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2tk/zlb1212b.zip
curl -LO https://mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2tk/ssl102ub.zip
unzip wat3211b.zip
unzip zlb1212b.zip
unzip ssl102ub.zip
) Build: export WATT_PATH=/opt/djgpp/net/watt
export ZLIB_PATH=/opt/djgpp
export OPENSSL_PATH=/opt/djgpp
export PATH="${PATH}:/opt/djgpp/bin/"
make -f Makefile.dist djgpp-zlib-ssl or export WATT_PATH=/opt/djgpp/net/watt
export ZLIB_PATH=/opt/djgpp
export OPENSSL_PATH=/opt/djgpp
export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp-
export CFG=-zlib-ssl
make -C lib -f Makefile.mk
make -C src -f Makefile.mk
|
If there is any objection to this, I can update the PR to retain existing MS-DOS/Amiga build files and just keep most updates to |
I haven't looked at this in detail, but I do like reducing the number of different build methods 👍 |
Of course both autotools and cmake uses (or can use) GNU Make. Within curl-for-win it means using raw/pure GNU Make without an extra generator layer like cmake/autotools (or something proprietary). This makes the term project agnostic. (E.g. curl uses `Makefile.m32`, awaiting [1] a rename to `Makefile.mk`, libssh2 uses `GNUMakefile`, etc.) It's also more greppable and less ambiguous than some alternatives ('make', 'gmake', 'mk'). [1] curl/curl#9764
With the upstream PR merge, adapt our script for the changes. Meaning simpler local configuration and using `Makefile.mk` instead of `Makefile.m32`. Ref: curl/curl#9764
gcc/ld does not like this: CPPFLAGS += -I"$(WATT_PATH)/inc"
_LDFLAGS += -L"$(WATT_PATH)/lib" But this works: CPPFLAGS += -I$(WATT_PATH)/inc
_LDFLAGS += -L$(WATT_PATH)/lib |
In that case I'd prefer to revert and reapply without the MS-DOS (and AmigaOS) parts. Or just cherry-pick a few commits. Reason being: double quotes are everywhere for other dependencies, so fixing watt is not enough. Making double quotes a variable would make everything look unreadable. Before I do so: What environment / gcc/ld version is where double-quotes are not recognized? (In my tests, double-quotes worked without issues, though I only tested cross-builds, not actually running the build on MS-DOS.) Also, would this work better?: CPPFLAGS += "-I$(WATT_PATH)/inc"
_LDFLAGS += "-L$(WATT_PATH)/lib" |
I'm on Win-10 using djgpp's gcc ver. 12.
That doesn't work either:
|
Odd. Reverting. |
If someone is in the know of an easy fix for these issues, it'd be a more desirable solution of course. |
Another option is to give up supporting dependency paths with spaces. I don't like it, but don't mind either. Also, spaces weren't actively tested. This would undo this commit that added support back in 2011: a6c168b |
Agree. Having paths with spaces in SW-development is madness. |
Sorry but I disagree. Quoting should work at least when the whole argument is quoted "-Ifoo". If it doesn't then that's a failure of the build system and not curl. |
It's puzzling that a recent DJGPP, built for Windows, on a recent Windows cannot handle double-quoted parameters. I'm not in the position to make tests, but I'm curious how/why this can happen. Double-quoted parameters are supposed to work fine on Windows, last time I checked. |
But single quotes works:
So perhaps some shell/make issue? |
Interesting. In the classic Windows shell (pre-Win10 at least), single quotes do not work, while double-quotes do. In unixy shells, both should work. Did this change with newer Windows shell(s)? Also, things may be mixed up when using a GNU Make .exe built for a different environment (say Cygwin). Back then I had the best results with I guess it'd be useful to know more about your particular env. GNU Make version and build, Windows version, shell, DJGPP version? What's also strange, that these double-quotes were there for a decade+ and nobody reported and issue with it on Windows. This assumes that everyone run it under MSYS[2], or did not run it at all, both unlikely, or something else at play. |
Add a
And issue with those escaped quotes ( |
@gvanem Is it so that you're using a Cygwin shell with a non-Cygwin It'd be worth a try without using anything from Cygwin. Cygwin is a rat's nest of issues, especially when mixed in with non-Cygwin tools. The MSYS2 shell would be a good match for |
MSYS2 shells are some variation of a cygwin shell because it's a fork of cygwin. mingw32-make should probably be run from the command prompt. |
@jay: MSYS2 somewhat confusingly offers two GNU Make builds: make.exe [dl] and mingw32-make.exe [dl]. Equivalent builds to the latter are shipping with non-MSYS2 toolchain packages, too. I've verified my notes and Having said that, I agree fully that the best is to use it with the native Windows shell. Also the easiest. [ Another source of confusion is that the DJGPP Windows cross-toolchain doesn't come with a GNU Make, and Windows doesn't have one by default either, so one needs to figure out that |
That's correct. Have worked fine for year. Edit: I spawn Cygwin's |
Based on what we know so far I don't consider this a That said, it would be nice to see if it works in a non-Cygwin shell, preferably with I'm also okay to remove myself from the MS-DOS-business and go along with the revert. |
I went along and tested this, and I cannot replicate it. The linked, standalone DJGPP cross-toolchain for Windows, MSYS2's One other thing I found is that the Here's my batch file: set CROSSPREFIX=C:/djgpp/bin/i586-pc-msdosdjgpp-
set WATT_PATH=C:/djgpp/net/watt
set ZLIB_PATH=C:/djgpp
set OPENSSL_PATH=C:/djgpp
set CFG=-zlib-ssl
C:\msys64\mingw64\bin\mingw32-make -C lib -f Makefile.mk
C:\msys64\mingw64\bin\mingw32-make -C src -f Makefile.mk With this, I'm "closing" this issue and the PR without merging. If someone wants to merge anyway, or apply any other fix or documentation update, feel free of course. |
Try with |
Is there any one of those that create a build breakage? Otherwise assuming an empty value for them is fine. Some of those are undefined on purpose, so that the caller can pass values (e.g. |
Then it should read |
I'm going to add In general I don't see the value in silencing these debug warnings. Setting everything to empty by default and in |
- Fix `NROFF` auto-detection with certain shell/make-build combinations: When a non-MSYS2 GNU Make runs inside an MSYS2 shell, Make executes the detection command as-is via `CreateProcess()`. It fails because `command` is an `sh` built-in. Ensure to explicitly invoke the shell. - Initialize user-customizable variables: Silences a list of warnings when running GNU Make with the option `--warn-undefined-variables`. Another benefit is that it's now easy to look up all user-customizable `Makefile.mk` variables by grepping for ` ?=` in the curl source tree. Suggested-by: Gisle Vanem Ref: #9764 (comment) - Fix `MKDIR` invocation: Avoid a warning and potential issue in envs without forward-slash support. Closes #10000
Update
Makefile.m32
to:ARCH
withTRIPLET
.tool_hugehelp.c
proper (when tools are available).USE_ZLIB
(replaced byHAVE_LIBZ
)ZLIB_LIBS
to override-lz
.CC
togcc
once again, for convenience. (Caveat: compiler namecc
cannot be set now.)-DCURL_NO_OLDIES
for examples, like autotools does.makefile.dj
files. Notice the configuration details and defaults are not retained with the new method.makefile.amiga
files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files.Makefile.m32
toMakefile.mk
to reflect that they are not Windows/MinGW32-specific anymore.CFG
options:-map
,-debug
,-trackmem
-DNDEBUG
by default.-DOS=...
in alllib/config-*.h
headers, syncing this withconfig-win32.h
.$ZLIB_PATH/include
and$ZLIB_PATH/lib
instead of bare$ZLIB_PATH
.set-DOS=
with the manually set or auto-detectedTRIPLET
value.Merged separately:
CROSSPREFIX
. [→ Makefile.m32: reintroduce CROSSPREFIX and -W -Wall [ci skip] #9784]-W -Wall
. [→ Makefile.m32: reintroduce CROSSPREFIX and -W -Wall [ci skip] #9784]Closes #xxxx
More readable diff without whitespaces: https://github.com/curl/curl/pull/9764/files?w=1
[ci skip]