Put hashlink binaries in templates/bin again.
Add setup script for macOS codesigning.
This commit is contained in:
@@ -225,6 +225,14 @@ class LinuxPlatform extends PlatformTarget
|
||||
System.recursiveCopyTemplate(project.templatePaths, "bin/hl/linux", applicationDirectory);
|
||||
System.copyFile(targetDirectory + "/obj/ApplicationMain.hl", Path.combine(applicationDirectory, "hlboot.dat"));
|
||||
System.renameFile(Path.combine(applicationDirectory, "hl"), executablePath);
|
||||
// let's not keep around hxcpp's hash files
|
||||
for (file in System.readDirectory(applicationDirectory))
|
||||
{
|
||||
if (Path.extension(file) == "hash")
|
||||
{
|
||||
System.deleteFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetType == "nodejs")
|
||||
{
|
||||
@@ -417,7 +425,8 @@ class LinuxPlatform extends PlatformTarget
|
||||
}
|
||||
}
|
||||
|
||||
if(targetFlags.exists("hl")) {
|
||||
if (targetFlags.exists("hl"))
|
||||
{
|
||||
CPPHelper.rebuild(project, commands, null, "BuildHashlink.xml");
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,14 @@ class MacPlatform extends PlatformTarget
|
||||
// System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl",
|
||||
// Path.combine(executableDirectory, project.app.file + ".hl"));
|
||||
System.recursiveCopyTemplate(project.templatePaths, "bin/hl/mac", executableDirectory);
|
||||
// let's not keep around hxcpp's hash files
|
||||
for (file in System.readDirectory(applicationDirectory))
|
||||
{
|
||||
if (Path.extension(file) == "hash")
|
||||
{
|
||||
System.deleteFile(file);
|
||||
}
|
||||
}
|
||||
System.copyFile(targetDirectory + "/obj/ApplicationMain.hl", Path.combine(executableDirectory, "hlboot.dat"));
|
||||
System.renameFile(Path.combine(executableDirectory, "hl"), executablePath);
|
||||
}
|
||||
@@ -382,25 +390,6 @@ class MacPlatform extends PlatformTarget
|
||||
if (targetFlags.exists("hl"))
|
||||
{
|
||||
CPPHelper.rebuild(project, commands, null, "BuildHashlink.xml");
|
||||
// TODO
|
||||
|
||||
// Sys.command("sudo", ["security", "delete-identity", "-c", "hl-cert"]);
|
||||
// sys.io.File.saveContent("openssl.cnf", "[req]\ndistinguished_name=codesign_dn\n[codesign_dn]\ncommonName=hl-cert\n[v3_req]\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=critical,codeSigning");
|
||||
// Sys.command("openssl", [
|
||||
// "req", "-x509", "-newkey", "rsa:4096", "-keyout", "key.pem", "-nodes", "-days", "365", "-subj", "/CN=hl-cert", "-outform", "der", "-out",
|
||||
// "cert.cer", "-extensions", "v3_req", "-config", "openssl.cnf"
|
||||
// ]);
|
||||
// Sys.command("sudo", [
|
||||
// "security",
|
||||
// "add-trusted-cert",
|
||||
// "-d",
|
||||
// "-k /Library/Keychains/System.keychain",
|
||||
// "cert.cer"
|
||||
// ]);
|
||||
// Sys.command("sudo", ["security", "import", "key.pem", "-k", "/Library/Keychains/System.keychain", "-A"]);
|
||||
// Sys.command("codesign", ["--entitlements", "other/osx/entitlements.xml", "-fs", "hl-cert", "hl"]);
|
||||
// for (f in ["key.pem", "cert.cer", "openssl.cnf"])
|
||||
// sys.FileSystem.deleteFile(f);
|
||||
}
|
||||
|
||||
CPPHelper.rebuild(project, commands);
|
||||
|
||||
@@ -345,6 +345,14 @@ class WindowsPlatform extends PlatformTarget
|
||||
System.recursiveCopyTemplate(project.templatePaths, "bin/hl/windows", applicationDirectory);
|
||||
System.copyFile(targetDirectory + "/obj/ApplicationMain.hl", Path.combine(applicationDirectory, "hlboot.dat"));
|
||||
System.renameFile(Path.combine(applicationDirectory, "hl.exe"), executablePath);
|
||||
// let's not keep around hxcpp's hash files
|
||||
for (file in System.readDirectory(applicationDirectory))
|
||||
{
|
||||
if (Path.extension(file) == "hash")
|
||||
{
|
||||
System.deleteFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
var iconPath = Path.combine(applicationDirectory, "icon.ico");
|
||||
|
||||
|
||||
@@ -1185,21 +1185,49 @@ class PlatformSetup
|
||||
|
||||
public static function setupHL():Void
|
||||
{
|
||||
Log.println("\x1b[1mIn order to build HashLink executables you must have");
|
||||
Log.println("HashLink binaries installed.");
|
||||
Log.println("We recommend using version \"1.10.0\"");
|
||||
Log.println("available as a free download from Github.\x1b[0m");
|
||||
|
||||
var answer = CLIHelper.ask("Would you like to visit the download page now?");
|
||||
|
||||
if (answer == YES || answer == ALWAYS)
|
||||
if (System.hostPlatform == MAC)
|
||||
{
|
||||
System.openURL(hashlinkURL);
|
||||
}
|
||||
Log.println("To use the hashlink debugger on macOS, the hl executable needs to be signed.");
|
||||
var answer = CLIHelper.ask("Would you like to do this now? (Requires sudo.)");
|
||||
|
||||
getDefineValue("HL_PATH", "Path to Hashlink binaries.");
|
||||
Log.println("");
|
||||
Log.println("Setup completed");
|
||||
if (answer == YES || answer == ALWAYS)
|
||||
{
|
||||
final openSSLConf = System.getTemporaryFile("cnf");
|
||||
final key = System.getTemporaryFile("pem");
|
||||
final cert = System.getTemporaryFile("cer");
|
||||
final limePath = Haxelib.getPath(new Haxelib("lime"));
|
||||
final hlPath = limePath + "/templates/bin/hl/mac/hl";
|
||||
final entitlementsPath = sys.FileSystem.exists(limePath + "/project") ? (limePath +
|
||||
"/project/lib/hashlink/other/osx/entitlements.xml") : (limePath
|
||||
+ "/templates/bin/hl/entitlements.xml");
|
||||
System.runCommand("", "sudo", ["security", "delete-identity", "-c", "hl-cert"], true, false, true);
|
||||
sys.io.File.saveContent(openSSLConf, [
|
||||
"[req]",
|
||||
"distinguished_name=codesign_dn",
|
||||
"[codesign_dn]",
|
||||
"commonName=hl-cert",
|
||||
"[v3_req]",
|
||||
"keyUsage=critical,digitalSignature",
|
||||
"extendedKeyUsage=critical,codeSigning",
|
||||
].join("\n"));
|
||||
System.runCommand("", "openssl", [
|
||||
"req", "-x509", "-newkey", "rsa:4096", "-keyout", key, "-nodes", "-days", "365", "-subj", "/CN=hl-cert", "-outform", "der", "-out", cert,
|
||||
"-extensions", "v3_req", "-config", openSSLConf
|
||||
], true, false, true);
|
||||
System.runCommand("", "sudo", [
|
||||
"security",
|
||||
"add-trusted-cert",
|
||||
"-d",
|
||||
"-k /Library/Keychains/System.keychain",
|
||||
cert
|
||||
], true, false, true);
|
||||
System.runCommand("", "sudo", ["security", "import", key, "-k", "/Library/Keychains/System.keychain", "-A"], true, false, true);
|
||||
System.runCommand("", "codesign", ["--entitlements", entitlementsPath, "-fs", "hl-cert", hlPath], true, false, true);
|
||||
for (f in [key, cert, openSSLConf])
|
||||
sys.FileSystem.deleteFile(f);
|
||||
Log.println("\nIf you update lime, yo will have to run this again to sign the new hl executable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function throwPermissionsError()
|
||||
|
||||
Reference in New Issue
Block a user