PORTING.md (1494B)
1 <!-- 2 Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 4 SPDX-License-Identifier: curl 5 --> 6 7 # porting libcurl 8 9 The basic approach I use when porting libcurl to another OS when the existing 10 configure or cmake build setups are not suitable. 11 12 ## Build 13 14 Write a build script/Makefile that builds *all* C files under lib/. If 15 possible, use the `lib/Makefile.inc` that lists all files in Makefile 16 variables. 17 18 In the Makefile, make sure you define what OS you build for: `-D[OPERATING 19 SYSTEM]`, or similar. Perhaps the compiler in use already define a standard 20 one? Then you might not need to define your own. 21 22 ## Add the new OS 23 24 In the `lib/curl_config.h` header file, in the section for when `HAVE_CONFIG_H` 25 is *not* defined (starting at around line 150), add a new conditional include 26 in this style: 27 28 ~~~c 29 #ifdef [OPERATING SYSTEM] 30 # include "config-operatingsystem.h" 31 #endif 32 ~~~ 33 34 Create `lib/config-operatingsystem.h`. You might want to start with copying a 35 another config-* file and then start trimming according to what your 36 environment supports. 37 38 ## Build it 39 40 When you run into compiler warnings or errors, the 41 `lib/config-operatingsystem.h` file should be where you should focus your work 42 and edits. 43 44 A recommended approach is to define a lot of the `CURL_DISABLE_*` defines (see 45 the [CURL-DISABLE](../CURL-DISABLE.md) document) initially to help narrow down 46 the initial work as that can save you from having to give attention to areas of 47 the code that you do not care for in your port.