]> gitweb.factorcode.org Git - factor.git/blob - extra/mason/release/sign/sign.factor
de25df62685946ee636426b6a18f60fc857b5133
[factor.git] / extra / mason / release / sign / sign.factor
1 ! Copyright (C) 2016 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io.backend io.pathnames kernel literals locals
4 mason.common namespaces sequences system ;
5 IN: mason.release.sign
6
7 <<
8 ! Two cases to allow signing in mason or in the UI
9 : make-factor-path ( path -- path )
10     build-dir [
11         ! In a build, make dir: "build-dir/factor/factor.com"
12         [ "factor/" prepend-path ] dip prepend-path
13     ] [
14         ! Not in build, make dir: "resource:factor.com"
15         "resource:" prepend-path normalize-path
16     ] if* ;
17
18 HOOK: cert-path os ( -- path/f )
19
20 M: object cert-path f ;
21
22 M: macosx cert-path
23     home "config/mac_app.cer" append-path ;
24
25 M: windows cert-path
26     home "config/FactorSPC.pfx" append-path ;
27 >>
28
29 HOOK: sign-factor-app os ( -- )
30
31 M: object sign-factor-app ;
32
33 M:: macosx sign-factor-app ( -- )
34     ${
35         "codesign" "--force" "--sign"
36         "Developer ID Application"
37         cert-path
38     }
39     "Factor.app/" make-factor-path suffix
40     short-running-process ;
41
42 M:: windows sign-factor-app ( -- )
43     { "factor.com" "factor.exe" } [
44         [
45             ${
46                 "signtool" "sign"
47                 "/v"
48                 "/f" cert-path
49             }
50         ] dip make-factor-path suffix short-running-process
51     ] each ;
52
53 HOOK: sign-archive os ( path -- )
54
55 M: object sign-archive drop ;
56
57 ! Sign the .dmg on macOS as well to avoid Gatekeeper marking
58 ! the xattrs as quarantined.
59 ! https://github.com/factor/factor/issues/1896
60 M: macosx sign-archive ( path -- )
61     ${
62         "codesign" "--force" "--sign"
63         "Developer ID Application"
64         cert-path
65     } swap suffix
66     short-running-process ;