Преглед на файлове

build: add codesign_osx make target (#368)

Quentin Dreyer преди 5 години
родител
ревизия
af995b1821
променени са 5 файла, в които са добавени 26 реда и са изтрити 0 реда
  1. 1 0
      Brewfile
  2. 9 0
      Makefile
  3. 4 0
      README.md
  4. 4 0
      other/azure-pipelines/build-mac.yml
  5. 8 0
      other/osx/entitlements.xml

+ 1 - 0
Brewfile

@@ -9,3 +9,4 @@ brew "libvorbis"
 brew "openal-soft"
 brew "mbedtls"
 brew "libuv"
+brew "openssl"

+ 9 - 0
Makefile

@@ -207,6 +207,15 @@ release_osx:
 	tar -czf hl-$(HL_VER).tgz hl-$(HL_VER)
 	rm -rf hl-$(HL_VER)
 
+codesign_osx:
+	echo "[req]\ndistinguished_name=codesign_dn\n[codesign_dn]\ncommonName=hl-cert\n[v3_req]\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=critical,codeSigning" > openssl.cnf
+	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
+	sudo security add-trusted-cert -d -k /Library/Keychains/System.keychain cert.cer
+	sudo security import key.pem -k /Library/Keychains/System.keychain
+	codesign --entitlements other/osx/entitlements.xml -fs hl-cert hl
+	sudo security delete-identity -c hl-cert
+	rm key.pem cert.cer openssl.cnf
+
 .SUFFIXES : .c .o
 
 .c.o :

+ 4 - 0
README.md

@@ -29,6 +29,10 @@ Once dependencies are installed you can simply call:
 
 `make`
 
+To be able to use hashlink binary with the debugger you can then call:
+
+`sudo make codesign_osx`
+
 To install hashlink binaries on your system you can then call:
 
 `make install`

+ 4 - 0
other/azure-pipelines/build-mac.yml

@@ -29,6 +29,8 @@ jobs:
           displayName: CMake
         - script: make
           displayName: Build
+        - script: sudo make codesign_osx
+          displayName: Codesign
         - script: |
             set -ex
             otool -L ./bin/hl
@@ -44,6 +46,8 @@ jobs:
       - ${{ if eq(parameters.buildSystem, 'make') }}:
         - script: make
           displayName: Build
+        - script: sudo make codesign_osx
+          displayName: Codesign
         - script: sudo make install
           displayName: Install
         - script: |

+ 8 - 0
other/osx/entitlements.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+    <key>com.apple.security.get-task-allow</key>
+    <true/>
+</dict>
+</plist>