Skip to content

Commit

Permalink
Add osx build
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Nov 22, 2019
1 parent 9f80ccb commit acb0d9a
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 5 deletions.
Binary file added BTCPayServerVault.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Build/Info.plist.xml
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
</array>
<key>CFBundleIconFile</key>
<string>BTCPayServerVault.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>{VersionPrefix}</string>
<key>CFBundleVersion</key>
<string>{VersionPrefix}</string>
<key>CFBundleExecutable</key>
<string>BTCPayServer.Vault</string>
<key>CFBundleName</key>
<string>{ApplicationName}</string>
<key>CFBundleIdentifier</key>
<string>btcpayserver.vault</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSAppleScriptEnabled</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.finance</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
</dict>
</plist>
87 changes: 87 additions & 0 deletions Build/build.osx-x64.Dockerfile
@@ -0,0 +1,87 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.101-buster AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends genisoimage git zlib1g-dev cmake make gcc g++ icnsutils imagemagick
WORKDIR /source/Build
RUN wget -qO hwi.tar.gz https://github.com/bitcoin-core/HWI/releases/download/1.0.3/hwi-1.0.3-mac-amd64.tar.gz && \
tar -zxvf hwi.tar.gz -C . hwi && \
echo "b0219f4f51d74e4525dd57a19f1aee9df409a879e041ea65f2d70cf90ac48a32 hwi" | sha256sum -c - && \
rm hwi.tar.gz

WORKDIR /tmp
ENV CC "gcc"
ENV CXX "g++"
RUN git clone https://github.com/theuni/libdmg-hfsplus && \
cd libdmg-hfsplus && \
git checkout libdmg-hfsplus-v0.1 && \
cmake . && \
make && \
cp dmg/dmg /bin && \
cd .. && rm -rf libdmg-hfsplus


WORKDIR /source
ENV RUNTIME "osx-x64"
COPY BTCPayServerVault.ico BTCPayServerVault.ico
COPY BTCPayServer.Hwi/BTCPayServer.Hwi.csproj BTCPayServer.Hwi/BTCPayServer.Hwi.csproj
COPY BTCPayServer.Vault/BTCPayServer.Vault.csproj BTCPayServer.Vault/BTCPayServer.Vault.csproj
ENV BUILD_ARGS "--runtime $RUNTIME -p:Configuration=Release -p:GithubDistrib=true"
RUN dotnet restore $BUILD_ARGS BTCPayServer.Vault/BTCPayServer.Vault.csproj
COPY BTCPayServer.Hwi BTCPayServer.Hwi
COPY BTCPayServer.Vault BTCPayServer.Vault
ENV FRAMEWORK "netcoreapp3.0"
RUN dotnet publish --no-restore --framework $FRAMEWORK $BUILD_ARGS BTCPayServer.Vault/BTCPayServer.Vault.csproj

COPY Build/extract-project-variables.sh Build/extract-project-variables.sh
COPY Build/Info.plist.xml Build/Info.plist
SHELL ["/bin/bash", "-c"]
RUN source Build/extract-project-variables.sh "BTCPayServer.Vault/BTCPayServer.Vault.csproj" && \
sed -i "s/{VersionPrefix}/$VERSION/g" Build/Info.plist && \
sed -i "s/{ApplicationName}/$TITLE/g" Build/Info.plist

COPY BTCPayServerVault.png /tmp/BTCPayServerVault.png
WORKDIR /tmp
RUN src=/tmp/BTCPayServerVault.png && \
dest=/tmp/BTCPayServerVault.iconset && mkdir $dest && \
convert -background none -resize '!16x16' "$src" "$dest/icon_16x16.png" && \
convert -background none -resize '!32x32' "$src" "$dest/icon_16x16@2x.png" && \
cp "$dest/icon_16x16@2x.png" "$dest/icon_32x32.png" && \
convert -background none -resize '!64x64' "$src" "$dest/icon_32x32@2x.png" && \
convert -background none -resize '!128x128' "$src" "$dest/icon_128x128.png" && \
convert -background none -resize '!256x256' "$src" "$dest/icon_128x128@2x.png" && \
cp "$dest/icon_128x128@2x.png" "$dest/icon_256x256.png" && \
convert -background none -resize '!512x512' "$src" "$dest/icon_256x256@2x.png" && \
cp "$dest/icon_256x256@2x.png" "$dest/icon_512x512.png" && \
convert -background none -resize '!1024x1024' "$src" "$dest/icon_512x512@2x.png" && \
# available on linux
# png2icns is more finicky about its input than iconutil
# 1. it doesn't support a 64x64 (aka 32x32@2x)
# 2. it doesn't like duplicates (128x128@2x == 256x256)
rm "$dest/icon_128x128@2x.png" && \
rm "$dest/icon_256x256@2x.png" && \
rm "$dest/icon_16x16@2x.png" && \
rm "$dest/icon_32x32@2x.png" && \
png2icns /source/Build/BTCPayServerVault.icns "$dest"/*png

RUN source /source/Build/extract-project-variables.sh "/source/BTCPayServer.Vault/BTCPayServer.Vault.csproj" && \
macfolder=/tmp/Output/$TITLE.App && \
mkdir -p "$macfolder/Contents" && \
cp /source/Build/Info.plist "$macfolder/Contents/" && \
mv /source/BTCPayServer.Vault/bin/Release/$FRAMEWORK/$RUNTIME/publish "$macfolder/Contents/MacOS" && \
mv /source/Build/hwi "$macfolder/Contents/MacOS/" && \
mkdir -p "$macfolder/Resources" && \
cp /source/Build/BTCPayServerVault.icns "$macfolder/Resources/" && \
genisoimage -no-cache-inodes \
-D \
-l \
-probe \
-V "$TITLE" \
-no-pad \
-r \
-dir-mode 0755 \
-apple \
-o uncompressed.dmg \
"$macfolder/.." && \
mkdir -p /source/Build/Output && \
dmg dmg uncompressed.dmg /source/Build/Output/BTCPayServerVault-$VERSION-setup.dmg && rm uncompressed.dmg

ENTRYPOINT [ "/bin/bash", "-c", "cp /source/Build/Output/* /opt/Output/" ]
11 changes: 7 additions & 4 deletions Build/build.ps1
@@ -1,6 +1,9 @@
New-Item -Path "Output" -ItemType "Directory" -Force
rm -Force -Recurse "Output\**"
docker build -t temp -f build.win-x64.Dockerfile ..
docker run --rm --name vaultbuild -d temp sleep 100
docker cp vaultbuild:/source/Build/Output/ .
docker rm --force vaultbuild


foreach ($arch in "win-x64","osx-x64")
{
docker build -t "vault-$arch" -f "build.${arch}.Dockerfile" ..
docker run --rm -v "$(pwd)/Output:/opt/Output" "vault-$arch"
}
2 changes: 2 additions & 0 deletions Build/build.win-x64.Dockerfile
Expand Up @@ -48,3 +48,5 @@ RUN mkdir -p Output && \
"-DPRODUCT_PUBLISHER=$COMPANY" \
"-DPRODUCT_DESCRIPTION=$DESCRIPTION" \
vault.nsis

ENTRYPOINT [ "/bin/bash", "-c", "cp /source/Build/Output/* /opt/Output/" ]
2 changes: 1 addition & 1 deletion Build/vault.nsis
Expand Up @@ -50,7 +50,7 @@
Caption "${PRODUCT_NAME}"

;Adds the Product Version on top of the Version Tab in the Properties of the file.
VIProductVersion ${PRODUCT_VERSION}
VIProductVersion ${PRODUCT_VERSION}.0

;VIAddVersionKey - Adds a field in the Version Tab of the File Properties. This can either be a field provided by the system or a user defined field.
VIAddVersionKey ProductName "${PRODUCT_NAME} Installer"
Expand Down

0 comments on commit acb0d9a

Please sign in to comment.