aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2017-11-10 22:14:40 +0000
committerGitHub <noreply@github.com>2017-11-10 22:14:40 +0000
commit82c1c5b3fe408df0086cb36c06a054e0126fbebd (patch)
tree82d352287f40436cbf80c56a872dcf95e89447ba
parent40281d595dd4e56952e44d09678d420fc67fd4a8 (diff)
parent6d880bc3bb5b78ce6d38fae56c6b8ab3390095ed (diff)
Merge pull request #142 from zangent/master
Added static linking for macOS, too. There's literally %number% of us!
-rwxr-xr-xbuild.sh6
-rw-r--r--src/main.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 3858da548..3f18c955f 100755
--- a/build.sh
+++ b/build.sh
@@ -7,11 +7,13 @@ libraries="-pthread -ldl -lm -lstdc++"
other_args=""
compiler="clang"
+if [ -z "$release_mode" ]; then release_mode="0"; fi
+
if [ "$release_mode" -eq "0" ]; then
- other_args="${other_args} -g
+ other_args="${other_args} -g"
fi
if [ "$release_mode" -eq "1" ]; then
- other_args="${other_args} -O3 -march=native
+ other_args="${other_args} -O3 -march=native"
fi
if [[ "$(uname)" == "Darwin" ]]; then
diff --git a/src/main.cpp b/src/main.cpp
index adb690dad..d3a705ab0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -833,7 +833,10 @@ int main(int arg_count, char **arg_ptr) {
if(lib.len > 2 && lib[0] == '-' && lib[1] == 'f') {
// framework thingie
len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " -framework %.*s ", (int)(lib.len) - 2, lib.text + 2);
- } else if (string_has_extension(lib, str_lit("dylib"))) {
+ } else if (string_has_extension(lib, str_lit("a"))) {
+ // static libs, absolute full path relative to the file in which the lib was imported from
+ len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " %.*s ", LIT(lib));
+ } else if (string_has_extension(lib, str_lit("dylib"))) {
// dynamic lib, relative path to executable
len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " -l:%s/%.*s ", cwd, LIT(lib));
} else {
@@ -869,7 +872,6 @@ int main(int arg_count, char **arg_ptr) {
char *linker;
if (build_context.is_dll) {
// Shared libraries are .dylib on MacOS and .so on Linux.
- // TODO(zangent): Is that statement entirely truthful?
#if defined(GB_SYSTEM_OSX)
output_ext = ".dylib";
#else