aboutsummaryrefslogtreecommitdiff
path: root/dev/build/osx/make-macos-dmg.sh
blob: 2550cbb31c8f36865ade0b893aafe0c75927050b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

# Fail on first error
set -e

# Configuration setup
DMGDIR=$PWD/_dmg
VERSION=$(sed -n -e '/^let coq_version/ s/^[^"]*"\([^"]*\)"$/\1/p' configure.ml)
APP=bin/CoqIDE_${VERSION}.app

# Install Coq into the .app file
make OLDROOT="$OUTDIR" COQINSTALLPREFIX="$APP/Contents/Resources" install-coq install-ide-toploop

# Fill .app file with metadata and other .app specific stuff (like non-system .so)
make PRIVATEBINARIES="$APP" -j 1 -l2 "$APP" VERBOSE=1

# Create the dmg bundle
mkdir -p "$DMGDIR"
ln -sf /Applications "$DMGDIR/Applications"
cp -r "$APP" "$DMGDIR"

mkdir -p _build

# Temporary countermeasure to hdiutil error 5341
# head -c9703424 /dev/urandom > $DMGDIR/.padding

hdi_opts=(-volname "coq-$VERSION-installer-macos"
          -srcfolder "$DMGDIR"
          -ov # overwrite existing file
          -format UDZO
          -imagekey "zlib-level=9"

          # needed for backward compat since macOS 10.14 which uses APFS by default
          # see discussion in #11803
          -fs hfs+
         )
hdiutil create "${hdi_opts[@]}" "_build/coq-$VERSION-installer-macos.dmg"