From 0790f1e63c45eabaeb61b7dfa4a0d9d4ff824124 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 18 Feb 2020 12:50:47 -0500 Subject: Allow compilation on OSX. Not much else I assume --- src/CMakeLists.txt | 6 +++++- src/compat.c | 9 ++++++++- src/environment.c | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a0a69a..b9dc7f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,11 @@ include_directories( ) add_executable(spm spm.c config.c compat.c deps.c fs.c rpath.c find.c shell.c archive.c str.c relocation.c install.c config_global.c manifest.c checksum.c extern/url.c version_spec.c spm_build.c mime.c internal_cmd.c environment.c mirrors.c strlist.c shlib.c) -target_link_libraries(spm rt crypto ssl curl) + +target_link_libraries(spm crypto ssl curl) +if (LINUX) + target_link_libraries(spm rt) +endif() if(MSVC) target_compile_options(spm PRIVATE /W4 /WX) diff --git a/src/compat.c b/src/compat.c index 062c939..5fd2cc4 100644 --- a/src/compat.c +++ b/src/compat.c @@ -13,4 +13,11 @@ char *strsep(char **sp, char *sep) *sp = p; return(s); } -#endif \ No newline at end of file +#endif + +#ifndef HAVE_REALLOCARRAY +#include +void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) { + return realloc(__ptr, __nmemb * __size); +} +#endif diff --git a/src/environment.c b/src/environment.c index b56b8de..f8d4fdb 100644 --- a/src/environment.c +++ b/src/environment.c @@ -395,4 +395,4 @@ void runtime_free(RuntimeEnv *env) { return; } strlist_free(env); -} \ No newline at end of file +} -- cgit