]> gitweb.factorcode.org Git - factor.git/blob - extra/mason/release/sign/sign.factor
Switch to https urls
[factor.git] / extra / mason / release / sign / sign.factor
1 ! Copyright (C) 2016 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: io.backend io.pathnames kernel literals mason.common
4 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
16     ] if* normalize-path ;
17
18 HOOK: cert-path os ( -- path/f )
19
20 M: object cert-path f ;
21
22 M: macosx cert-path home "config/mac_app.cer" append-path ;
23
24 M: windows cert-path home "config/FactorSPC.pfx" append-path ;
25 >>
26
27 HOOK: sign-factor-app os ( -- )
28
29 M: object sign-factor-app ;
30
31 M: macosx sign-factor-app
32     {
33         "Factor.app/"
34         "libfactor.dylib"
35         "libfactor-ffi-test.dylib"
36     } [
37         ${
38             "codesign" "--force" "--sign"
39             "Developer ID Application"
40             cert-path
41         } swap make-factor-path suffix short-running-process
42     ] each ;
43
44 M:: windows sign-factor-app ( -- )
45     { "factor.com" "factor.exe" } [
46         ${
47             "signtool" "sign"
48             "/fd" "sha256"
49             "/v"
50             "/f" cert-path
51         } swap make-factor-path suffix short-running-process
52     ] each ;
53
54 HOOK: sign-archive os ( path -- )
55
56 M: object sign-archive drop ;
57
58 ! Sign the .dmg on macOS as well to avoid Gatekeeper marking
59 ! the xattrs as quarantined.
60 ! https://github.com/factor/factor/issues/1896
61 M: macosx sign-archive
62     ${
63         "codesign" "--force" "--sign"
64         "Developer ID Application"
65         cert-path
66     } swap suffix
67     short-running-process ;