Skip to content

Commit 851acc2

Browse files
committed
[*.h,CMakeLists.txt] Ensure all macros have LIBACQUIRE_ prefix ; remove impl STATIC in favour of one SHARED (to resolve build on MSVC) ; WiP get new shared library to build correctly
1 parent 28407dd commit 851acc2

27 files changed

+463
-373
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ project(acquire
33
VERSION "0.0.1"
44
LANGUAGES C)
55

6-
set(HOMEPAGE_URL "https://github.com/offscale/${PROJECT_NAME}")
6+
set(HOMEPAGE_URL "https://github.com/offscale/lib${PROJECT_NAME}")
77
set(DESCRIPTION "The core for your package manager. Features: download, verify, and extract.")
88

99
set(CMAKE_C_STANDARD 90)
1010
set(CMAKE_VERBOSE_MAKEFILE ON)
1111
set(CMAKE_C_VISIBILITY_PRESET hidden)
1212
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
1313

14-
if (DEFINED USE_MY_LIBFETCH) # Experiments
15-
add_compile_definitions(USE_MY_LIBFETCH=1)
14+
if (DEFINED LIBACQUIRE_USE_MY_LIBFETCH) # Experiments
15+
add_compile_definitions(LIBACQUIRE_USE_MY_LIBFETCH=1)
1616

1717
if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
1818
add_compile_definitions(WITH_SSL=1)
1919
set(WITH_SSL 1)
2020
else ()
2121
add_compile_definitions(HAVE_REALLOCARRAY=1)
2222
endif ()
23-
endif (DEFINED USE_MY_LIBFETCH)
23+
endif (DEFINED LIBACQUIRE_USE_MY_LIBFETCH)
2424

2525
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
2626

@@ -119,7 +119,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
119119
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
120120
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
121121

122-
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
122+
option(BUILD_SHARED_LIB "Build shared library" ON)
123123

124124
if (APPLE)
125125
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ libacquire
77

88
The core for your package manager, minus the dependency graph components. Features: **download**, **verify**, and **extract**.
99

10-
By default—for HTTP, HTTPS, and FTP—this uses `libfetch` on FreeBSD; `wininet` on Windows; and `libcurl` everywhere else. Override with `-DUSE_LIBCURL` or `-DUSE_LIBFETCH`.
10+
By default—for HTTP, HTTPS, and FTP—this uses `libfetch` on FreeBSD; `wininet` on Windows; and `libcurl` everywhere else. Override with `-DLIBACQUIRE_USE_LIBCURL` or `-DLIBACQUIRE_USE_LIBFETCH`.
1111

12-
By default—for MD5, SHA256, SHA512—this uses `wincrypt` on Windows; and `OpenSSL` everywhere else. _Note that on macOS this uses the builtin `CommonCrypto/CommonDigest.h` header, and on OpenBSD it uses `LibreSSL`; however in both of these cases it's the OpenSSL API with different headers._ Override with `-DUSE_OPENSSL`.
12+
By default—for MD5, SHA256, SHA512—this uses `wincrypt` on Windows; and `OpenSSL` everywhere else. _Note that on macOS this uses the builtin `CommonCrypto/CommonDigest.h` header, and on OpenBSD it uses `LibreSSL`; however in both of these cases it's the OpenSSL API with different headers._ Override with `-DLIBACQUIRE_USE_OPENSSL`.
1313

1414
By default—for crc32c—this uses `rhash` if available (also giving access to: CRC32, MD4, MD5, SHA1, SHA256, SHA512, SHA3, AICH, ED2K, DC++ TTH, BitTorrent BTIH, Tiger, GOST R 34.11-94, GOST R 34.11-2012, RIPEMD-160, HAS-160, EDON-R, and Whirlpool); otherwise uses included crc32c implementation. Override with `-DUSE_CRC32C`.
1515

@@ -46,39 +46,39 @@ If your OS doesn't have the dependency, an optimised dependency-free version wil
4646

4747
| API | Package enable flag | OS support |
4848
| ------- | ------------------- | ---------- |
49-
| [`wincrypt.h`](https://docs.microsoft.com/en-us/windows/win32/api/wincrypt) | `USE_WINCRYPT` | Windows †
50-
| [OpenSSL](https://openssl.org) | `USE_COMMON_CRYPTO` | macOS † |
51-
| [OpenSSL](https://openssl.org) | `USE_LIBRESSL` | All that [LibreSSL](https://libressl.org) supports |
52-
| [OpenSSL](https://openssl.org) | `USE_OPENSSL` | All that [OpenSSL](https://openssl.org) supports; default † on non macOS and Windows |
49+
| [`wincrypt.h`](https://docs.microsoft.com/en-us/windows/win32/api/wincrypt) | `LIBACQUIRE_USE_WINCRYPT` | Windows †
50+
| [OpenSSL](https://openssl.org) | `LIBACQUIRE_USE_COMMON_CRYPTO` | macOS † |
51+
| [OpenSSL](https://openssl.org) | `LIBACQUIRE_USE_LIBRESSL` | All that [LibreSSL](https://libressl.org) supports |
52+
| [OpenSSL](https://openssl.org) | `LIBACQUIRE_USE_OPENSSL` | All that [OpenSSL](https://openssl.org) supports; default † on non macOS and Windows |
5353

5454
(will fallback to checksum library if undefined and only hashing is required and checksum library defined isn't CRC32C)
5555

5656
### Networking
5757

5858
| API | Package enable flag | OS support |
5959
| ------- | ------------------- | ---------- |
60-
| [WinINet](https://docs.microsoft.com/en-us/windows/win32/wininet) | `USE_WININET` | Windows † |
61-
| [libfetch](https://www.freebsd.org/cgi/man.cgi?fetch(3)) | `USE_LIBFETCH` | FreeBSD † & derivatives; other OS support WiP (try `BUILD_FREEBSD_LIBFETCH`)
62-
| \* [OpenBSD's `ftp`](https://man.openbsd.org/ftp.1) | `USE_OPENBSD_FTP` | OpenBSD † (try `BUILD_OPENBSD_FTP`)
63-
| [libcurl](https://curl.se/libcurl) | `USE_LIBCURL` | All that [`curl`](https://curl.se) supports; default † on non macOS and Windows
60+
| [WinINet](https://docs.microsoft.com/en-us/windows/win32/wininet) | `LIBACQUIRE_USE_WININET` | Windows † |
61+
| [libfetch](https://www.freebsd.org/cgi/man.cgi?fetch(3)) | `LIBACQUIRE_USE_LIBFETCH` | FreeBSD † & derivatives; other OS support WiP (try `BUILD_FREEBSD_LIBFETCH`)
62+
| \* [OpenBSD's `ftp`](https://man.openbsd.org/ftp.1) | `LIBACQUIRE_USE_OPENBSD_FTP` | OpenBSD † (try `BUILD_OPENBSD_FTP`)
63+
| [libcurl](https://curl.se/libcurl) | `LIBACQUIRE_USE_LIBCURL` | All that [`curl`](https://curl.se) supports; default † on non macOS and Windows
6464

6565
### Extraction
6666

6767
| API | Package enable flag | OS support |
6868
| ------- | ------------------- | ---------- |
69-
| \* [`compressapi.h`](https://docs.microsoft.com/en-us/windows/win32/api/_cmpapi) | `USE_WINCOMPRESSAPI` | Windows †
70-
| \* [zlib](https://zlib.net) | `USE_ZLIB` | All that zlib supports; default † (if installed) on macOS, Linux, BSD, and SunOS
71-
| \* [libarchive](https://libarchive.org) | `USE_LIBARCHIVE` | All that libarchive supports
72-
| [miniz](https://github.com/richgel999/miniz) with [zip](https://github.com/kuba--/zip) API | `USE_MINIZ` | All that miniz + zip supports; default † fallback
69+
| \* [`compressapi.h`](https://docs.microsoft.com/en-us/windows/win32/api/_cmpapi) | `LIBACQUIRE_USE_WINCOMPRESSAPI` | Windows †
70+
| \* [zlib](https://zlib.net) | `LIBACQUIRE_USE_ZLIB` | All that zlib supports; default † (if installed) on macOS, Linux, BSD, and SunOS
71+
| \* [libarchive](https://libarchive.org) | `LIBACQUIRE_USE_LIBARCHIVE` | All that libarchive supports
72+
| [miniz](https://github.com/richgel999/miniz) with [zip](https://github.com/kuba--/zip) API | `LIBACQUIRE_USE_MINIZ` | All that miniz + zip supports; default † fallback
7373

7474
### Checksum
7575

7676
Note that most checksum libraries are crypto libraries, so working with these APIs isn't required for libacquire:
7777

7878
| API | Package enable flag | OS support |
7979
----------------------------------------------------------------| ------------------- |---------------------------------|
80-
| \* `acquire_crc32c.h` | `USE_CRC32C` | All |
81-
| \* [RHash (Recursive Hasher)](https://github.com/rhash/RHash) | `USE_LIBRHASH` | All; † fallback to `USE_CRC32C`
80+
| \* `acquire_crc32c.h` | `LIBACQUIRE_USE_CRC32C` | All |
81+
| \* [RHash (Recursive Hasher)](https://github.com/rhash/RHash) | `LIBACQUIRE_USE_LIBRHASH` | All; † fallback to `LIBACQUIRE_USE_CRC32C`
8282

8383
## Docker
8484

0 commit comments

Comments
 (0)