@@ 9,11 9,13 @@ string version;
string framework_bundle = "Pike.framework";
-array sdk_locs = ({"/Developer/SDKs", "/SDKs", "/Developer"});
+array sdk_locs = ({"/Developer/SDKs", "/SDKs", "/Developer", "/Library/Developer/CommandLineTools/SDKs"});
+
+int no_embedded_pike = 0;
string gcc = "clang";
-string sdk = "MacOSX10.9.sdk";
-string cc_args = "-mmacosx-version-min=10.9 -isysroot ${SDK} -m32 -arch i386 -F.";
+string sdk = "MacOSX10.14.sdk";
+string cc_args = "-mmacosx-version-min=10.10 -isysroot ${SDK} -F. -I/usr/local/include";
string ld_args = "-lobjc -lpthread -framework AppKit -framework Pike -framework System -framework Foundation";
int main(int argc, array(string) argv)
@@ 36,6 38,7 @@ int parse_args(array(string) argv)
{
foreach(Getopt.find_all_options(argv,aggregate(
({"help",Getopt.NO_ARG,({"--help"}) }),
+ ({"no_embedded_pike",Getopt.NO_ARG,({"--no-embedding"}) }),
({"identifier",Getopt.HAS_ARG,({"--identifier"}) }),
({"gcc",Getopt.HAS_ARG,({"--with-gcc"}) }),
({"sdk",Getopt.HAS_ARG,({"--with-sdk"}) }),
@@ 45,6 48,9 @@ int parse_args(array(string) argv)
{
switch(opt[0])
{
+ case "no_embedded_pike":
+ no_embedded_pike = 1;
+ break;
case "identifier":
identifier = opt[1];
break;
@@ 103,7 109,7 @@ void make_app()
{
write("mkapp: generating application bundle for %s\n", app_name);
- if(!file_stat(framework_bundle))
+ if(!no_embedded_pike && !file_stat(framework_bundle))
{
werror("mkapp: Pike framework %O does not exist. aborting.\n", framework_bundle);
exit(2);
@@ 120,21 126,23 @@ void make_app()
Stdio.mkdirhier(app_name + ".app/Contents/Resources");
Stdio.mkdirhier(app_name + ".app/Contents/Frameworks");
- make_file(app_name + ".m", app_stub);
+ if(!no_embedded_pike)
+ make_file(app_name + ".m", app_stub);
make_file(app_name + ".app/Contents/Resources/" + app_name + ".pike", pike_stub);
make_file(app_name + ".app/Contents/PkgInfo", pkg_info);
make_file(app_name + ".app/Contents/Info.plist", info_plist);
- Process.system("cp -Rf \"" + framework_bundle + "\" \"" + app_name + ".app/Contents/Frameworks\"");
+ if(!no_embedded_pike) {
+ Process.system("cp -Rf \"" + framework_bundle + "\" \"" + app_name + ".app/Contents/Frameworks\"");
- string my_cc_args = find_sdk(cc_args);
- string my_ld_args = find_sdk(ld_args);
+ string my_cc_args = find_sdk(cc_args);
+ string my_ld_args = find_sdk(ld_args);
- my_system(gcc + " " + my_cc_args + " -c '" + app_name + ".m' -o '" + app_name + ".o'");
+ my_system(gcc + " " + my_cc_args + " -c '" + app_name + ".m' -o '" + app_name + ".o'");
// my_system(gcc + " " + my_cc_args + " -c method_getArgInfo.m -o '" + app_name + "_getArgInfo.o'");
- my_system(gcc + " " + my_cc_args + " '" + app_name + ".o' -o '" + app_name + ".app/Contents/MacOS/" + app_name + "' " + ld_args);
- rm(app_name + ".o");
-
+ my_system(gcc + " " + my_cc_args + " '" + app_name + ".o' -o '" + app_name + ".app/Contents/MacOS/" + app_name + "' " + ld_args);
+ rm(app_name + ".o");
+ }
write("mkapp: Build complete.\n");
}
@@ 162,7 170,7 @@ string find_sdk(string args)
if(file_stat(candidate)) { fqsdk = candidate; break; }
}
- if(!fqsdk) { werror("SDK " + sdk + " found in (" + sdk_locs*", " + ").\n"); exit(1);}
+ if(!fqsdk) { werror("SDK " + sdk + " not found in (" + sdk_locs*", " + ").\n"); exit(1);}
write("mkapp: found SDK at %s\n", fqsdk);
return replace(args, "${SDK}", fqsdk);
@@ 295,7 303,7 @@ free_svalue(sv);
sv = [i evalString: @\"add_module_path(\\\"modules\\\")\"];
free_svalue(sv);
-sv2 = [i evalString: @\"master()->resolv(\\\"Public.ObjectiveC.module\\\")\"];
+sv2 = [i evalString: @\"master()->resolv(\\\"Public.ObjectiveC.Cocoa\\\")\"];
free_svalue(sv2);
push_text(\"__APPPATH\");
@@ 346,6 354,7 @@ constant help_text =
Options:
--help
+ --no-embedding don't build stub binary
--version=bundle_version
--identifier=bundle_identifier
--framework=path_to_pike_framework