|
|
@ -17,6 +17,24 @@ VERSION=`git describe --tags --dirty --always` |
|
|
|
|
|
|
|
which brew > /dev/null 2>&1 || fail "Please install brew from https://brew.sh/ to continue" |
|
|
|
|
|
|
|
# Code Signing: See https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html |
|
|
|
APP_SIGN="" |
|
|
|
if [ -n "$1" ]; then |
|
|
|
# Test the identity is valid for signing by doing this hack. There is no other way to do this. |
|
|
|
cp -f /bin/ls ./CODESIGN_TEST |
|
|
|
codesign -s "$1" --dryrun -f ./CODESIGN_TEST > /dev/null 2>&1 |
|
|
|
res=$? |
|
|
|
rm -f ./CODESIGN_TEST |
|
|
|
if ((res)); then |
|
|
|
fail "Code signing identity \"$1\" appears to be invalid." |
|
|
|
fi |
|
|
|
unset res |
|
|
|
APP_SIGN="$1" |
|
|
|
info "Code signing enabled using identity \"$APP_SIGN\"" |
|
|
|
else |
|
|
|
warn "Code signing DISABLED. Specify a valid macOS Developer identity installed on the system as the first argument to this script to enable signing." |
|
|
|
fi |
|
|
|
|
|
|
|
info "Installing Python $PYTHON_VERSION" |
|
|
|
export PATH="~/.pyenv/bin:~/.pyenv/shims:~/Library/Python/3.6/bin:$PATH" |
|
|
|
if [ -d "~/.pyenv" ]; then |
|
|
@ -54,6 +72,7 @@ info "Downloading libusb..." |
|
|
|
curl https://homebrew.bintray.com/bottles/libusb-1.0.22.el_capitan.bottle.tar.gz | \ |
|
|
|
tar xz --directory $BUILDDIR |
|
|
|
cp $BUILDDIR/libusb/1.0.22/lib/libusb-1.0.dylib contrib/build-osx |
|
|
|
DoCodeSignMaybe "libusb" "contrib/build-osx/libusb-1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop |
|
|
|
|
|
|
|
info "Building libsecp256k1" |
|
|
|
brew install autoconf automake libtool |
|
|
@ -66,6 +85,7 @@ git clean -f -x -q |
|
|
|
make |
|
|
|
popd |
|
|
|
cp $BUILDDIR/secp256k1/.libs/libsecp256k1.0.dylib contrib/build-osx |
|
|
|
DoCodeSignMaybe "libsecp256k1" "contrib/build-osx/libsecp256k1.0.dylib" "$APP_SIGN" # If APP_SIGN is empty will be a noop |
|
|
|
|
|
|
|
|
|
|
|
info "Installing requirements..." |
|
|
@ -96,5 +116,14 @@ plutil -insert 'CFBundleURLTypes' \ |
|
|
|
-- dist/$PACKAGE.app/Contents/Info.plist \ |
|
|
|
|| fail "Could not add keys to Info.plist. Make sure the program 'plutil' exists and is installed." |
|
|
|
|
|
|
|
DoCodeSignMaybe "app bundle" "dist/${PACKAGE}.app" "$APP_SIGN" # If APP_SIGN is empty will be a noop |
|
|
|
|
|
|
|
info "Creating .DMG" |
|
|
|
hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG" |
|
|
|
|
|
|
|
DoCodeSignMaybe ".DMG" "dist/electrum-${VERSION}.dmg" "$APP_SIGN" # If APP_SIGN is empty will be a noop |
|
|
|
|
|
|
|
if [ -z "$APP_SIGN" ]; then |
|
|
|
warn "App was built successfully but was not code signed. Users may get security warnings from macOS." |
|
|
|
warn "Specify a valid code signing identity as the first argument to this script to enable code signing." |
|
|
|
fi |
|
|
|