Skip to content
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.m32: major rework [ci skip] #9632

Closed
wants to merge 82 commits into from
Closed

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Oct 2, 2022

This patch overhauls Makefile.m32 scripts, fixing a list of quirks, making its behaviour and customization envvars align better with other build systems, aiming for less code, that is easier to read, use and maintain.

Details:

  • Rename customization envvars:
    CURL_CC -> CC
    CURL_RC -> RC
    CURL_AR -> AR
    CURL_LDFLAG_EXTRAS_DLL -> CURL_LDFLAGS_LIB
    CURL_LDFLAG_EXTRAS_EXE -> CURL_LDFLAGS_BIN
  • Drop CURL_STRIP and CURL_RANLIB. These tools are no longer used.
  • Accept CFLAGS, CPPFLAGS, RCFLAGS, LDFLAGS and LIBS envvars.
  • Drop CURL_CFLAG_EXTRAS, CURL_LDFLAG_EXTRAS, CURL_RCFLAG_EXTRAS in
    favor of the above.
  • Do not automatically enable zlib with libssh2. zlib is optional
    with libssh2.
  • Omit unnecessary CPPFLAGS options when building curl.exe and
    examples.
  • Drop support for deprecated -winssl CFG option. Use -schannel
    instead.
  • Avoid late evaluation where not necessary (= -> :=).
  • Drop support for CURL_DLL_A_SUFFIX to override the implib suffix.
    Instead, use the standard naming scheme by default: libcurl.dll.a.
    The toolchain recognizes the name, and selects it automatically when
    asking for a -shared vs. -static build.
  • Stop applying strip to libcurl.a. Follow-up from
    16a58e9. There was no debug info to
    strip since then.
  • Stop setting -O3, -W, -Wall options. You can add these to
    CFLAGS as desired.
  • Always enable -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG with OpenSSL,
    to avoid that vulnerability on Windows.
  • Add -lbrotlicommon to LIBS when using brotli.
  • Do not enable -nghttp3 without -ngtcp2.
  • -ssh2 and -rtmp options no longer try to auto-select a TLS-backend.
    You need to set the backend explicitly. This scales better and avoids
    issues with certain combinations (e.g. libssh2 + wolfssl with no
    schannel).
  • Default to OpenSSL TLS-backend with ngtcp2. Possible to override via
    NGTCP2_LIBS.
  • Old, alternate method of enabling components (e.g. SSH2=1) no longer
    supported.
  • Delete SPNEGO references. They were no-ops.
  • Drop support for Win9x environments.
  • Allow setting OPENSSL_LIBS independently from OPENSSL_LIBPATH.
  • Support autotools/CMake libssh2 builds by default.
  • Respect CURL_DLL_SUFFIX in -dyn mode when building curl.exe and
    examples.
  • Assume standard directory layout with LIBCARES_PATH. (Instead of the
    long gone embedded one.)
  • Stop static linking with c-ares by default. Add
    CPPFLAGS=-DCARES_STATICLIB to enable it.
  • Reorganize internal layout to avoid redundancy and emit clean diffs
    between src/lib and example make files.
  • Delete unused variables.
  • Code cleanups/rework.
  • Comment and indentation fixes.

Closes #9632

This patch replaces `CURL_*` envvars [1][2] with more familiar ones,
which are also used in autotools and other build tools and which have
been in fact used internally by `Makefile.m32` scripts.

`CURL_CC` is now `CC`, `CURL_RANLIB` -> `RANLIB`, `CURL_RC` -> `RC`,
`CURL_STRIP` -> `STRIP`, `CURL_AR` -> `AR`.

This aims to make configuration more straighforward.

Also fix some indentation and delete `AR` assigments from src and
examples, where the value wasn't used.

[1] 1d5b7b7
[2] 4440b6a

Closes #xxxx
@vszakats vszakats added build Windows Windows-specific tidy-up labels Oct 2, 2022
@jay
Copy link
Member

jay commented Oct 2, 2022

Do you know of the reason curl_LDADD was used instead of LDFLAGS? It seems like that was an intentional choice but I don't know what advantage it would have.

for curl.exe, ZLIB flags are necessary for hugehelp compression.

Oddly enough, USE_NGTCP2 is used inside lib/dynbuf.c, which is
compiled into curl.exe directly. This has been fixed in 7.86.0 [0]
so let's drop this constant.

[0] f703cf9
@vszakats vszakats changed the title Makefile.m32: standardize tool customization envvars [ci skip] Makefile.m32: major cleanup [ci skip] Oct 3, 2022
…ckend

Things go complex quickly when introducing built-in support for mbedtls
or wolfssl (also for the CURL_WITH_MULTI_SSL setting), but for SSL vs
SCHANNEL only, the logic can remain simple.

To scale better, probably Makefile.m32 should not be overly clever here,
but instead expect the caller to explicitly set all necessary components.
This can cause problems when we want to build with a TLS-backend
that has no built-in support in Makefile.m32, e.g. SSH2 + wolfssl
and without Schannel.

After this patch, the CFG must contain any necessary TLS backend
explicitly.
@vszakats vszakats changed the title Makefile.m32: major cleanup [ci skip] Makefile.m32: major rework [ci skip] Oct 3, 2022
@vszakats vszakats closed this in 10fbd8b Oct 3, 2022
@vszakats vszakats deleted the m32stdize branch February 2, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants