diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-24 12:29:49 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-24 12:29:49 -0400 |
commit | 436ce68ecd41ad66e7a0605b47b5814582db8538 (patch) | |
tree | 4c54676d3ef16f3cae4244f94bdb1cb23a514926 /lib | |
parent | d570692d29d5dade7882ee19ca8d992a8960201d (diff) | |
download | spmc-436ce68ecd41ad66e7a0605b47b5814582db8538.tar.gz |
Consolidate platform detection preprocessor checks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config_global.c | 6 | ||||
-rw-r--r-- | lib/error_handler.c | 1 | ||||
-rw-r--r-- | lib/extern/url.c | 2 | ||||
-rw-r--r-- | lib/internal_cmd.c | 4 | ||||
-rw-r--r-- | lib/mime.c | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/lib/config_global.c b/lib/config_global.c index 52589d4..95302c3 100644 --- a/lib/config_global.c +++ b/lib/config_global.c @@ -129,11 +129,11 @@ void check_runtime_environment(void) { int bad_rt = 0; char *required[] = { "file", -#if defined(__linux) || defined(__linux__) +#if OS_LINUX "patchelf", -#elif defined(__APPLE__) && defined(__MACH__) +#elif OS_DARWIN "install_name_tool", -#elif defined(__WIN32__) +#elif OS_WINDOWS // TODO: Does windows provide some kind of equivalent? #endif "objdump", diff --git a/lib/error_handler.c b/lib/error_handler.c index cb2ef51..aa48274 100644 --- a/lib/error_handler.c +++ b/lib/error_handler.c @@ -13,6 +13,7 @@ const char *SPM_ERR_STRING[] = { "Failed to fetch package", "Manifest has no header", "Manifest has no data", + "Parsing error", NULL, }; diff --git a/lib/extern/url.c b/lib/extern/url.c index fe54db2..c39b314 100644 --- a/lib/extern/url.c +++ b/lib/extern/url.c @@ -137,7 +137,7 @@ static int fill_buffer(URL_FILE *file, size_t want) { curl_multi_fdset() doc. */ if (maxfd == -1) { -#ifdef _WIN32 +#ifdef _WIN32 // OS_WINDOWS not available at this level Sleep(100); rc = 0; #else diff --git a/lib/internal_cmd.c b/lib/internal_cmd.c index e5f875f..6f6b1c6 100644 --- a/lib/internal_cmd.c +++ b/lib/internal_cmd.c @@ -237,9 +237,9 @@ int mkruntime_interface(int argc, char **argv) { } runtime_set(rt, "CFLAGS", "-I$SPM_INCLUDE $CFLAGS"); -#if defined(__APPLE__) && defined (__MACH__) +#if OS_DARWIN runtime_set(rt, "LDFLAGS", "-rpath $SPM_LIB:$SPM_LIB64 -L$SPM_LIB -L$SPM_LIB64 $LDFLAGS"); -#elif defined(__linux) || defined (__linux__) +#elif OS_LINUX runtime_set(rt, "LDFLAGS", "-Wl,-rpath=$SPM_LIB:$SPM_LIB64 -L$SPM_LIB -L$SPM_LIB64 $LDFLAGS"); #else // TODO: Windows? @@ -14,7 +14,7 @@ Process *file_command(const char *_filename) { Process *proc_info = NULL; char sh_cmd[PATH_MAX]; sh_cmd[0] = '\0'; -#ifdef __APPLE__ +#if OS_DARWIN const char *fmt_cmd = "file -I \"%s\" 2>&1"; #else // GNU const char *fmt_cmd = "file -i \"%s\" 2>&1"; |