Skip to content

Commit 41423f8

Browse files
authored
Merge pull request #3268 from input-output-hk/fix/previous-macos
[LW-12086] fix: `libiconv.dylib` issue on previous macOS
2 parents d9a45a0 + 184bc1b commit 41423f8

16 files changed

+381
-706
lines changed

installers/Installer.hs

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import qualified System.Info as Sys
77
import Turtle (export)
88
import qualified System.IO as IO
99

10-
import qualified MacInstaller
1110
import qualified WindowsInstaller
1211
import Data.Yaml (decodeFileThrow)
1312

@@ -20,7 +19,6 @@ main = do
2019
IO.hSetEncoding IO.stdout IO.utf8
2120
let os = case Sys.os of
2221
"linux" -> Linux64
23-
"darwin" -> Macos64
2422
"mingw32" -> Win64
2523
_ -> error ("Unsupported OS: " <> pack Sys.os)
2624

@@ -43,5 +41,4 @@ genSignedInstaller os options'= do
4341
export "NETWORK" (clusterNetwork $ oCluster options')
4442
case os of
4543
Linux64 -> putStrLn ("Use default.nix, please." :: String)
46-
Macos64 -> MacInstaller.main options'
4744
Win64 -> WindowsInstaller.main options'

installers/Spec.hs

-32
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,13 @@ import Data.Aeson (decode)
1919

2020
import Config
2121
import Types
22-
import qualified MacInstaller as Mac
2322
import Util
2423

2524
main :: IO ()
2625
main = hspec $ do
2726
describe "Utility functions" utilSpec
28-
describe "MacInstaller build" macBuildSpec
2927
describe "recursive directory deletion" deleteSpec
3028

31-
macBuildSpec :: Spec
32-
macBuildSpec = do
33-
describe "The whole thing" $ do
34-
it "Runs through the whole installer build" $ runManaged $ do
35-
out <- getTempDir "test-build"
36-
installersDir <- makeTestInstallersDir
37-
daedalusBridge <- liftIO getDaedalusBridge
38-
39-
let opts = Options
40-
{ oOS = Win64
41-
, oBackend = Cardano daedalusBridge
42-
, oBuildJob = Just (BuildJob "test")
43-
, oCluster = Testnet
44-
, oAppName = "Daedalus"
45-
, oOutputDir = out
46-
, oTestInstaller = testInstaller False
47-
, oSigningConfigPath = Nothing
48-
}
49-
50-
liftIO $ do
51-
withDir installersDir $ do
52-
mktree "../release/darwin-x64/Daedalus-darwin-x64/Daedalus.app/Contents/Resources/app"
53-
mktree "../release/darwin-arm64/Daedalus-darwin-arm64/Daedalus.app/Contents/Resources/app"
54-
writeFile "../release/darwin-x64/Daedalus-darwin-x64/Daedalus.app/Contents/Resources/app/package.json" "{}"
55-
writeFile "../release/darwin-arm64/Daedalus-darwin-arm64/Daedalus.app/Contents/Resources/app/package.json" "{}"
56-
Mac.main opts
57-
58-
-- there should be an installer file at the end
59-
fold (ls out) Fold.length `shouldReturn` 1
60-
6129
-- | Set up a temporary source/installers directory with everything
6230
-- required for the installer builder. This is so that the installer
6331
-- builder can be tested in a pure environment without any

installers/codesign.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
SIGN_ID="$1"
4+
KEYCHAIN="$2"
5+
REL_PATH="$3"
6+
XML_PATH="$4"
7+
ABS_PATH="$(pwd)/$REL_PATH"
8+
TS="$(date +%Y-%m-%d_%H-%M-%S)"
9+
function sign_cmd() {
10+
for targetFile in "$@" ; do
11+
codesign --force --verbose=4 --deep --strict --timestamp --options=runtime --entitlements $XML_PATH --sign "$SIGN_ID" "$targetFile" 2>&1 | tee -a /tmp/codesign-output-${TS}.txt
12+
done
13+
}
14+
VERIFY_CMD="codesign --verbose=4 --verify --deep --strict"
15+
ENTITLEMENT_CMD="codesign -d --entitlements :-"
16+
LOG="2>&1 | tee -a /tmp/codesign-output-${TS}.txt"
17+
18+
# Remove symlinks pointing outside of the project build folder:
19+
rm -f "$ABS_PATH/Contents/Resources/app/result"
20+
21+
# Ensure the code signing identity is found and set the keychain search path:
22+
eval "security show-keychain-info \"$KEYCHAIN\" $LOG"
23+
eval "security find-identity -v -p codesigning \"$KEYCHAIN\" $LOG"
24+
eval "security list-keychains -d user -s \"$KEYCHAIN\" $LOG"
25+
26+
# Sign framework executables not signed by the deep sign command:
27+
sign_cmd "$ABS_PATH/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt"
28+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/Current/Resources/crashpad_handler"
29+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/libnode.dylib"
30+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/libffmpeg.dylib"
31+
32+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib"
33+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib"
34+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib"
35+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib"
36+
sign_cmd "$ABS_PATH/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvk_swiftshader.dylib"
37+
38+
# Sign the whole component deeply
39+
sign_cmd "$ABS_PATH"
40+
41+
# Verify the signing
42+
eval "$VERIFY_CMD \"$ABS_PATH\" $LOG"
43+
eval "$VERIFY_CMD --display -r- \"$ABS_PATH\"" "$LOG"
44+
eval "$ENTITLEMENT_CMD \"$ABS_PATH\"" "$LOG"
45+
set +x

installers/common/Config.hs

+1-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ data Options = Options
6363
, oOS :: OS
6464
, oCluster :: Cluster
6565
, oAppName :: AppName
66-
, oAppRootOverride :: Maybe FilePath
6766
, oDontPkgbuild :: Bool
6867
, oOutputDir :: FilePath
6968
, oTestInstaller :: TestInstaller
@@ -87,12 +86,11 @@ optionsParser detectedOS = Options
8786
<*> (optional $
8887
(BuildJob <$> optText "build-counter" 'v' "‘inputs.self.sourceInfo.revCount’"))
8988
<*> (fromMaybe detectedOS <$> (optional $
90-
optReadLower "os" 's' "OS, defaults to host OS. One of: linux64 macos64 win64"))
89+
optReadLower "os" 's' "OS, defaults to host OS. One of: linux64 win64"))
9190
<*> (fromMaybe Selfnode <$> (optional $
9291
optReadLower "cluster" 'c' "Cluster the resulting installer will target: mainnet, staging, or testnet"))
9392
<*> (fromMaybe "daedalus" <$> (optional $
9493
(AppName <$> optText "appname" 'n' "Application name: daedalus or..")))
95-
<*> (optional (optPath "app-root-override" 'r' "If you built the Electron app outside of MacInstaller.hs"))
9694
<*> (switch "dont-pkgbuild" 'd' "Stop after preparing the package (content root), don’t create the final *.pkg file")
9795
<*> optPath "out-dir" 'o' "Installer output directory"
9896
<*> (testInstaller

0 commit comments

Comments
 (0)