1 ! Copyright (C) 2016 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io.backend io.pathnames kernel literals mason.common
8 ! Two cases to allow signing in mason or in the UI
9 : make-factor-path ( path -- path )
11 ! In a build, make dir: "build-dir/factor/factor.com"
12 [ "factor/" prepend-path ] dip prepend-path
14 ! Not in build, make dir: "resource:factor.com"
15 "resource:" prepend-path
16 ] if* normalize-path ;
18 HOOK: cert-path os ( -- path/f )
20 M: object cert-path f ;
22 M: macosx cert-path "~/config/mac_app.cer" ;
24 M: windows cert-path "~/config/FactorSPC.pfx" ;
27 HOOK: sign-factor-app os ( -- )
29 M: object sign-factor-app ;
31 M:: macosx sign-factor-app ( -- )
33 "codesign" "--force" "--sign"
34 "Developer ID Application"
35 cert-path normalize-path
37 "Factor.app/" make-factor-path suffix
38 short-running-process ;
40 M:: windows sign-factor-app ( -- )
41 { "factor.com" "factor.exe" } [
46 "/f" cert-path normalize-path
48 ] dip make-factor-path suffix short-running-process
51 HOOK: sign-archive os ( path -- )
53 M: object sign-archive drop ;
55 ! Sign the .dmg on macOS as well to avoid Gatekeeper marking
56 ! the xattrs as quarantined.
57 ! https://github.com/factor/factor/issues/1896
58 M: macosx sign-archive ( path -- )
60 "codesign" "--force" "--sign"
61 "Developer ID Application"
64 short-running-process ;