Skip to content

Commit 7af3ef7

Browse files
committed
[acquire/acquire_common_defs.h] Fix ARM64 definition ; [*Dockerfile*] Rename for syntax highlighting ; add more bsd dependencies
1 parent 90e6645 commit 7af3ef7

File tree

8 files changed

+54
-29
lines changed

8 files changed

+54
-29
lines changed

Dockerfile.alpine

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Note that most checksum libraries are crypto libraries so working with these API
8383

8484
`Dockerfile`s are provided for convenience, try them out, e.g., by running:
8585
```sh
86-
docker build . -f Dockerfile.alpine --tag libacquire
86+
docker build . -f alpine.Dockerfile --tag libacquire
8787
docker run libacquire
8888
```
8989

acquire/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,15 @@ else ()
540540
set(gen_header_files "")
541541
set(gen_source_files "")
542542
foreach (header_file #${_Header_Files} ${Header_Files}
543-
"acquire_checksums.h" "acquire_common_defs.h" "acquire_download.h"
544-
"acquire_extract.h" "acquire_fileutils.h" "acquire_net_common.h"
545-
"acquire_string_extras.h" "acquire_url_utils.h")
543+
"acquire_checksums.h"
544+
"acquire_common_defs.h"
545+
"acquire_crc32c.h"
546+
"acquire_download.h"
547+
"acquire_extract.h"
548+
"acquire_fileutils.h"
549+
"acquire_net_common.h"
550+
"acquire_string_extras.h"
551+
"acquire_url_utils.h")
546552
get_filename_component(name_no_ext "${header_file}" NAME_WLE)
547553
set(gen_header_file "${CMAKE_BINARY_DIR}/gen/gen_${name_no_ext}.h")
548554
set(gen_source_file "${CMAKE_BINARY_DIR}/gen/gen_${name_no_ext}.c")

acquire/acquire_checksums.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ extern "C" {
2020
#endif
2121
#include "acquire_config.h"
2222
#include "acquire_string_extras.h"
23-
#ifdef USE_LIBRHASH
24-
#include "acquire_librhash.h"
25-
#endif /* USE_LIBRHASH */
2623

2724
extern LIBACQUIRE_LIB_EXPORT bool crc32c(const char *, const char *);
2825

acquire/acquire_common_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extern "C" {
8787
#define NAME_MAX 4096
8888
#endif /* ! NAME_MAX */
8989

90-
#if !defined(_AMD64_) && !defined(_X86_) && defined(_ARM_)
90+
#if !defined(_AMD64_) && !defined(_X86_) && !defined(_ARM_)
9191
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \
9292
defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
9393
#define _AMD64_

acquire/acquire_net_common.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ extern "C" {
1515
#include "acquire_common_defs.h"
1616

1717
/**
18-
* Check if a file represented by URL is already downloaded locally and matches the checksum.
18+
* Check if a file represented by URL is already downloaded locally and matches
19+
* the checksum.
1920
*
2021
* @param url URL or filename
2122
* @param checksum checksum enum type, e.g., LIBACQUIRE_SHA256
2223
* @param hash expected hash string to verify
23-
* @param target_location directory to check in (if NULL, defaults to ".downloads")
24+
* @param target_location directory to check in (if NULL, defaults to
25+
* ".downloads")
2426
* @return true if already downloaded and checksum verifies, else false
2527
*/
2628
extern LIBACQUIRE_LIB_EXPORT bool is_downloaded(const char *url,
27-
enum Checksum checksum,
28-
const char *hash,
29-
const char *target_location);
29+
enum Checksum checksum,
30+
const char *hash,
31+
const char *target_location);
3032

3133
#ifdef LIBACQUIRE_IMPLEMENTATION
3234

@@ -37,7 +39,8 @@ const char *get_download_dir() { return ".downloads"; }
3739

3840
/**
3941
* Implementation of is_downloaded.
40-
* Uses fileutils functions for existence checks and checksum functions for verification.
42+
* Uses fileutils functions for existence checks and checksum functions for
43+
* verification.
4144
*/
4245
bool is_downloaded(const char *url, enum Checksum checksum, const char *hash,
4346
const char *target_location) {

alpine.Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM alpine
2+
3+
RUN apk add --no-cache \
4+
bsd-compat-headers \
5+
cmake \
6+
curl-dev \
7+
gcc \
8+
libarchive-dev \
9+
libbsd-dev \
10+
rhash-dev \
11+
linux-headers \
12+
make \
13+
musl-dev \
14+
openssl-dev \
15+
pkgconf
16+
17+
COPY . /libacquire
18+
19+
WORKDIR /libacquire/build
20+
21+
RUN cmake -DCMAKE_BUILD_TYPE="Debug" .. && \
22+
cmake --build .
23+
24+
CMD ctest .
25+
26+
ENTRYPOINT ["/libacquire/build/acquire", "--version"]
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ ADD 'https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-lin
55
RUN sh /tmp/cmake.sh --prefix='/usr/local' --skip-license
66

77
RUN apt-get update -qq && \
8-
apt-get install -y gcc make pkg-config libc-dev libssl-dev libcurl4-openssl-dev
8+
apt-get install -y \
9+
gcc \
10+
libc-dev \
11+
libcurl4-openssl-dev \
12+
librhash-dev \
13+
libssl-dev \
14+
make \
15+
pkg-config
916

1017
COPY . /libacquire
1118

0 commit comments

Comments
 (0)