diff --git a/BTCPayServerVault.png b/BTCPayServerVault.png new file mode 100644 index 0000000..3f14a8a Binary files /dev/null and b/BTCPayServerVault.png differ diff --git a/Build/Info.plist.xml b/Build/Info.plist.xml new file mode 100644 index 0000000..d04ae38 --- /dev/null +++ b/Build/Info.plist.xml @@ -0,0 +1,34 @@ + + + + + LSMinimumSystemVersion + 10.12 + LSArchitecturePriority + + x86_64 + + CFBundleIconFile + BTCPayServerVault.icns + CFBundlePackageType + APPL + CFBundleShortVersionString + {VersionPrefix} + CFBundleVersion + {VersionPrefix} + CFBundleExecutable + BTCPayServer.Vault + CFBundleName + {ApplicationName} + CFBundleIdentifier + btcpayserver.vault + NSHighResolutionCapable + + NSAppleScriptEnabled + + LSApplicationCategoryType + public.app-category.finance + CFBundleInfoDictionaryVersion + 6.0 + + diff --git a/Build/build.osx-x64.Dockerfile b/Build/build.osx-x64.Dockerfile new file mode 100644 index 0000000..bed1d40 --- /dev/null +++ b/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/" ] diff --git a/Build/build.ps1 b/Build/build.ps1 index cb125be..059d2a0 100644 --- a/Build/build.ps1 +++ b/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" +} diff --git a/Build/build.win-x64.Dockerfile b/Build/build.win-x64.Dockerfile index 6e0479e..06f3c27 100644 --- a/Build/build.win-x64.Dockerfile +++ b/Build/build.win-x64.Dockerfile @@ -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/" ] diff --git a/Build/vault.nsis b/Build/vault.nsis index e687002..2fac962 100644 --- a/Build/vault.nsis +++ b/Build/vault.nsis @@ -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"