-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
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
`Makefile.mk` supported MS-DOS and Amiga, but `./configure` also supported them in a better tested and more flexible way. This patch also adds CMake support for MS-DOS/DJGPP and Amiga OS 3. `Makefile.mk` was not maintained. Delete it in favour of first-tier build methods. Also include some non-MS-DOS/AmigaOS-specific tidy-up, see details at the end of this message. Details: - fix/silence all MS-DOS/DJGPP build warnings and issues. - add MS-DOS support to cmake. - default to `ENABLE_THREADED_RESOLVER=OFF` for MS-DOS. - add support for `WATT_ROOT`. - use static libcurl with MS-DOS. - fixup default CMake suffixes/prefixes for DJGPP. - disable hidden symbols for MS-DOS. Not supported on MS-DOS. - opt-in MS-DOS into `USE_UNIX_SOCKETS`. - improve MS-DOS support in autotools. - default to `--disable-threaded-resolver` for MS-DOS. - make sure to use `close_s()` (from Watt-32) with autotools and cmake. `Makefile.mk` used it before this patch. - GHA: add DJGPP cmake (~30s) and autotools (~60s) build jobs. Also build tests and examples with cmake. - improve AmigaOS support in autotools: - configure: detect `CloseSocket()` when it's a macro. - configure: fix `IoctlSocket` detection on AmigaOS. - curl-amissl.m4: pass AmiSSL libs to tests/servers. - add AmigaOS3 support to cmake: - cmake: fix `HAVE_IOCTLSOCKET_CAMEL` and `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` detections. - set necessary system libs. - add AmiSSL support. - inet_ntop, inet_pton: fix using it for AmigaOS. cmake detects them, and they did not compile with AmigaOS. - cmake: better sync `gethostname` detection with autotools. Fixes detection for AmigaOS, where `gethostname` is a macro. - cmake: fix `sys/utime.h` detection on AmigaOS. - cmake: force-disable `getaddrinfo` for AmigaOS. - cmake: tweak threading and static/shared default for AmigaOS. - cmake: rely on manual variable `AMIGA` to enable the platform. - GHA: add AmigaOS cmake and autotools (~45s) jobs. Also build tests and examples with cmake. - INSTALL: update MS-DOS and AmigaOS build instructions. - amigaos: fix `-Wpointer-sign` and `zero or negative size array '_args'` in `Printf()`. - amigaos: fix `-Wpointer-sign` - amigaos: fix `-Wredundant-decls` `errno` and `h_errno`. - amigaos: brute-force silence `lseek()` size warnings. - amigaos: server/resolve: silence `-Wdiscarded-qualifiers`. - amigaos: server/resolve: fix `-Wpointer-sign`. - amigaos: fix `CURL_SA_FAMILY_T` type. - nonblock: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS. `ioctl` is also detected, but fails when used. Make the above override it for a successful build. Authored-by: Darren Banfi Fixes #15537 Closes #15603 - tftpd: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS. - tftpd: tidy-up conditional code. - curl: set stack size to 16384 for AmigaOS3/4 Overriding the default 4096. Suggested-by: Darren Banfi Ref: #15543 (comment) Ref: https://wiki.amigaos.net/wiki/Controlling_Application_Stack - functypes.h: fix `SEND_QUAL_ARG2` for AmigaOS. - tftp: add missing cast in sendto() call for AmigaOS. - getinfo: fix warning with AmigaOS. - tool_operate: silence warning with AmigaOS - amigaos: fix building libtests due to missing `RLIMIT_NOFILE`. - curl_gethostname: silence warning for AmigaOS. - ftp: silence `-Wtype-limits` for AmigaOS. - libtest: fix timeval initialization for AmigaOS. - examples: fix `timeval` initialization for AmigaOS. - examples: silence warning for AmigaOS. - configure: fix IPv6 detection for cross-builds. - netrc: fix to build with AmigaOS cleanly. - buildinfo: detect and add `DOS` tag for MS-DOS builds. - buildinfo: add `AMIGA` to buildinfo.txt in auttools. - build: move `USE_WATT32` macro definition to cmake/configure. Non-MS-DOS/AmigeOS-specific tidy-ups: - configure: sync `sa_family_t` detection with cmake. - configure: sync `ADDRESS_FAMILY` detection signals with cmake. - doh: use `CURL_SA_FAMILY_T`. - lib: drop mingw-specific `CURL_SA_FAMILY_T` workaround. - cmake: extend instead of override check-specific configurations/requirements. This allows to honor global requirements added earlier. Necessary for AmigaOS for example. - cmake: omit warning on disabled IPv6 for MS-DOS and AmigaOS. No IPv6 support on these platforms. Also sync with autotools. - lib1960: use libcurl `inet_pton()` wrapper. - cmake: detect LibreSSL (to match autotools). - cmake: say the specific OpenSSL flavour detected. - hostip: add missing `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` guard. - lib: simplify classic mac feature guards. Follow-up to a8861b6 #9764 Closes #15543
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]