diff options
author | Ori Bernstein <ori@eigenstate.org> | 2013-02-19 11:17:27 -0500 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2013-02-19 11:17:27 -0500 |
commit | 734d2e4ffd947e1a5fd73ae22029d3b0647be290 (patch) | |
tree | 904a41ca327cbb9bda80c04c15d42d6391202d34 /myrbuild | |
parent | adbf2578946f1658b3dd044f62e31a8689e8671e (diff) | |
download | mc-734d2e4ffd947e1a5fd73ae22029d3b0647be290.tar.gz |
Add system dependent behavior to myrbuild.
It probes the OS it runs on now, and changes the commands to
the appropriate ones. For now, that means changing the linker
command line to specify the OSX version.
In the future, when we support multiple architectures, it will
include probing the architecture as well.
Diffstat (limited to 'myrbuild')
-rw-r--r-- | myrbuild/myrbuild.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/myrbuild/myrbuild.c b/myrbuild/myrbuild.c index ae27c18..be2d048 100644 --- a/myrbuild/myrbuild.c +++ b/myrbuild/myrbuild.c @@ -6,6 +6,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> +#include <sys/utsname.h> #include <ctype.h> #include <fcntl.h> #include <unistd.h> @@ -38,6 +39,8 @@ size_t nlibs; /* the linker script to use */ char *ldscript; +char *sysname; + regex_t usepat; static void usage(char *prog) @@ -326,6 +329,14 @@ void linkobj(char **files, size_t nfiles) snprintf(buf, sizeof buf, "-l%s", libs[i]); lappend(&args, &nargs, strdup(buf)); } + + /* OSX wants a minimum version specified to prevent warnings*/ + if (!strcmp(sysname, "Darwin")) { + lappend(&args, &nargs, strdup("-macosx_version_min")); + lappend(&args, &nargs, strdup("10.6")); + } + + /* the null terminator for exec() */ lappend(&args, &nargs, NULL); run(args); @@ -339,7 +350,10 @@ int main(int argc, char **argv) { int opt; int i; + struct utsname name; + if (uname(&name) == 0) + sysname = strdup(name.sysname); while ((opt = getopt(argc, argv, "hb:l:s:I:C:A:M:L:R:")) != -1) { switch (opt) { case 'b': binname = optarg; break; |