curl/docs
Viktor Szakats 2a292c3984
build: add Windows CE / CeGCC support, with CI jobs
Make it possible to build curl for Windows CE using the CeGCC toolchain.
With both CMake and autotools, including tests and examples, also in CI.
The build configuration is the default one with Schannel enabled. No
3rd-party dependencies have been tested.

Also revive old code to make Schannel build with Windows CE, including
certificate verification.

Builds have been throughougly tested. But, I've made no functional tests
for this PR. Some parts (esp. file operations, like truncate and seek)
are stubbed out and likely broken as a result. Test servers build, but
they do not work on Windows CE. This patch substitutes `fstat()` calls
with `stat()`, which operate on filenames, not file handles. This may or
may not work and/or may not be secure.

About CeGCC: I used the latest available macOS binary build v0.59.1
r1397 from 2009, in native `mingw32ce` build mode. CeGCC is in effect
MinGW + GCC 4.4.0 + old/classic-mingw Windows headers. It targets
Windows CE v3.0 according to its `_WIN32_WCE` value. It means this PR
restores portions of old/classic-mingw support. It makes the Windows CE
codepath compatible with GCC 4.4.0. It also adds workaround for CMake,
which cannot identify and configure this toolchain out of the box.

Notes:
- CMake doesn't recognize CeGCC/mingw32ce, necessitating tricks as seen
  with Amiga and MS-DOS.
- CMake doesn't set `MINGW` for mingw32ce. Set it and `MINGW32CE`
  manually as a helper variable, in addition to `WINCE` which CMake sets
  based on `CMAKE_SYSTEM_NAME`.
- CMake fails to create an implib for `libcurl.dll`, due to not
  recognizing the platform as a Windowsy one. This patch adds the
  necessary workaround to make it work.
- headers shipping with CeGCC miss some things curl needs for Schannel
  support. Fixed by restoring and renovating code previously deleted
  old-mingw code.
- it's sometime non-trivial to figure out if a fallout is WinCE,
  mingw32ce, old-mingw, or GCC version-specific.
- WinCE is always Unicode. With exceptions: no `wmain`,
  `GetProcAddress()`.
- `_fileno()` is said to convert from `FILE *` to `void *` which is
  a Win32 file `HANDLE`. (This patch doesn't use this, but with further
  effort it probably could be.)
  https://stackoverflow.com/questions/3989545/how-do-i-get-the-file-handle-from-the-fopen-file-structure
- WinCE has no signals, current directory, stdio/CRT file handles, no
  `_get_osfhandle()`, no `errno`, no `errno.h`. Some of this stuff is
  standard C89, yet missing from this platform. Microsoft expects
  Windows CE apps to use Win32 file API and `FILE *` exclusively.
- revived CeGCC here (not tested for this PR):
  https://building.enlyze.com/posts/a-new-windows-ce-x86-compiler-in-2024/

On `UNDER_CE` vs. `_WIN32_WCE`: (This patch settled on `UNDER_CE`)

- A custom VS2008 WinCE toolchain does not set any of these.
  The compiler binaries don't contain these strings, and has no compiler
  option for targeting WinCE, hinting that a vanilla toolchain isn't
  setting any of them either.
- `UNDER_CE` is automatically defined by the CeGCC compiler.
  https://cegcc.sourceforge.net/docs/details.html
- `UNDER_CE` is similar to `_WIN32`, except it's not set automatically
  by all compilers. It's not supposed to have any value, like a version.
  (Though e.g. OpenSSL sets it to a version)
- `_WIN32_WCE` is the CE counterpart of the non-CE `_WIN32_WINNT` macro.
  That does return the targeted Windows CE version.
- `_WIN32_WCE` is not defined by compilers, and relies on a header
  setting it to a default, or the build to set it to the desired target
  version. This is also how `_WIN32_WINNT` works.
- `_WIN32_WCE` default is set by `windef.h` in CeGCC.
- `_WIN32_WCE` isn't set to a default by MSVC Windows CE headers (the
  ones I checked at least).
- CMake sets `_WIN32_WCE=<ver>`, `UNDER_CE`, `WINCE` for MSVC WinCE.
- `_WIN32_WCE` seems more popular in other projects, including CeGCC
  itself. `zlib` is a notable exception amongst curl dependencies,
  which uses `UNDER_CE`.
- Since `_WIN32_WCE` needs "certain" headers to have it defined, it's
  undefined depending on headers included beforehand.
- `curl/curl.h` re-uses `_WIN32_WCE`'s as a self-guard, relying on
  its not-(necessarily)-defined-by-default property:
  25b445e479/include/curl/curl.h (L77)

Toolchain downloads:
- Windows:
  https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_cygwin1.7_r1399.tar.bz2
- macOS Intel:
  https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_snowleopard_r1397.tar.bz2

Closes #15975
2025-02-21 13:56:34 +01:00
..
cmdline-opts ca-native.md: sync with CURLSSLOPT_NATIVE_CA 2025-02-19 03:39:52 -05:00
examples build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
internals strparse: provide access functions 2025-02-19 12:17:32 +01:00
libcurl ca-native.md: sync with CURLSSLOPT_NATIVE_CA 2025-02-19 03:39:52 -05:00
.gitignore docs: add RELEASE-TOOLS.md.dist to .gitignore 2024-07-01 22:49:55 +02:00
ALTSVC.md docs: bring back ALTSVC.md and HSTS.md 2024-12-09 09:32:19 +01:00
BINDINGS.md BINDINGS: add zig binding 2024-08-07 14:51:09 +02:00
BUG-BOUNTY.md BUG-BOUNTY.md: clarify the third party situation 2024-05-14 16:23:42 +02:00
BUGS.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
CIPHERS-TLS12.md docs: update CIPHERS.md 2024-08-12 23:35:56 +02:00
CIPHERS.md docs: correct argument names & URL redirection 2025-02-15 22:29:35 +01:00
CMakeLists.txt cmake: replace CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR 2024-10-22 19:13:08 +02:00
CODE_OF_CONDUCT.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
CODE_REVIEW.md docs: misc language polish 2024-07-01 16:45:17 +02:00
CONTRIBUTE.md CONTRIBUTE: polished 2024-08-26 15:04:01 +02:00
curl-config.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
CURL-DISABLE.md cmake: document -D and env build options 2024-10-24 23:06:40 +02:00
CURLDOWN.md curldown: fixups 2024-07-19 17:03:25 +02:00
DEPRECATE.md cmake: deprecate winbuild, add migration guide from legacy build methods 2025-01-10 18:20:52 +01:00
DISTROS.md DISTROS: update Alt Linux links 2024-11-29 00:54:47 -08:00
EARLY-RELEASE.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
ECH.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
EXPERIMENTAL.md docs/EXPERIMENTAL.md: add a mention of HTTPSRR as experimental 2025-01-16 19:41:42 +01:00
FAQ docs: suggest --ssl-reqd instead of --ftp-ssl 2024-12-02 09:07:50 +01:00
FEATURES.md FEATURES.md: fix typo 2024-08-23 08:46:09 +02:00
GOVERNANCE.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
HELP-US.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
HISTORY.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
HSTS.md docs: bring back ALTSVC.md and HSTS.md 2024-12-09 09:32:19 +01:00
HTTP3.md cmake: misc tidy-ups 2025-02-16 03:37:22 +01:00
HTTP-COOKIES.md docs/HTTP-COOKIES.md: link to more information 2025-01-01 22:45:48 +01:00
HTTPSRR.md docs/HTTPSRR.md: Typo fix AAA -> AAAA 2025-02-04 23:20:18 +01:00
INFRASTRUCTURE.md INFRASTRUCTURE.md: project infra 2025-01-05 11:25:06 +01:00
INSTALL
INSTALL-CMAKE.md cmake: SHARE_LIB_OBJECT=ON requires CMake 3.12 or newer 2025-02-18 15:05:39 +01:00
INSTALL.md INSTALL.md: add CMake examples for macOS and iOS 2025-01-27 12:49:12 +01:00
INTERNALS.md openssl: drop support for old OpenSSL/LibreSSL versions 2025-02-21 12:02:35 +01:00
IPFS.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
KNOWN_BUGS KNOWN_BUGS: fix typo 2025-02-19 07:54:03 +01:00
MAIL-ETIQUETTE.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
Makefile.am docs/HTTPSRR.md: initial HTTPS RR documentation 2025-01-25 23:51:01 +01:00
MANUAL.md docs: use valid example domain names 2025-02-09 00:17:05 +01:00
mk-ca-bundle.md curldown: make 'added-in:' a mandatory header field 2024-07-18 18:04:09 +02:00
options-in-versions vtls: feature ssls-export for SSL session im-/export 2025-01-08 23:32:07 +01:00
README.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
RELEASE-PROCEDURE.md RELEASE-PROCEDURE.md: mention how to publish security advisories 2024-12-11 11:11:32 +01:00
ROADMAP.md CI: add whitespace checker 2024-06-27 13:33:30 +02:00
RUSTLS.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
SECURITY-ADVISORY.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
SPONSORS.md SPONSORS.md: clarify that we don't promise goods or services 2025-02-05 23:40:24 +01:00
SSL-PROBLEMS.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
SSLCERTS.md curl: add options for safe/no CA bundle search (Windows) 2024-09-22 18:17:25 +02:00
THANKS THANKS: add contributors from 8.12.1 2025-02-13 08:14:17 +01:00
THANKS-filter THANKS: add contributors from 8.12.1 2025-02-13 08:14:17 +01:00
TheArtOfHttpScripting.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
TODO TODO: write an SMB test server to replace impacket 2025-01-16 20:51:00 +01:00
URL-SYNTAX.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
VERSIONS.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
VULN-DISCLOSURE-POLICY.md VULN-DISCLOSURE-POLICY: on legacy dependencies 2025-01-27 15:48:13 +01:00

curl logo

Documentation

You find a mix of various documentation in this directory and subdirectories, using several different formats. Some of them are not ideal for reading directly in your browser.

If you would rather see the rendered version of the documentation, check out the curl website's documentation section for general curl stuff or the libcurl section for libcurl related documentation.