build_macos.sh 3.5 KB
Newer Older
Roman Haefeli's avatar
Roman Haefeli committed
1
2
#!/bin/bash

3
4
5
6
app_name="netpd"
app_version="2.2"
app_bundle_name="${app_name}-${app_version}.app"
package_version=$(date +%Y-%m-%d)
Roman Haefeli's avatar
Roman Haefeli committed
7
8

# Pd
9
pd_archive_file=~/Downloads/pd-0.51-0.mac.tar.gz
Roman Haefeli's avatar
Roman Haefeli committed
10
11
12
13

# Libraries
ext_urls=()
ext_urls+=("http://puredata.info/Members/rdz/software/binfile-v0.1~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
14
ext_urls+=("https://www.netpd.org/~roman/tmp/else%5bv1.0beta28%5d(Darwin-amd64-32).dek")
Roman Haefeli's avatar
Roman Haefeli committed
15
16
17
18
19
20
21
22
23
24
25
26
ext_urls+=("http://puredata.info/Members/musil/software/iemlib/1.22/iemlib%5Bv1.22%5D(Darwin-amd64-32)(Darwin-i386-32)(Linux-amd64-32)(Windows-amd64-32)(Windows-i386-32)(Sources).dek")
ext_urls+=("http://puredata.info/Members/zmoelnigbot/software/iemnet/0.2.3/iemnet%5Bv0.2.3%5D(Darwin-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/zmoelnig/software/iem/20150529.2247/osc-v0.2-20150529iem-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
ext_urls+=("http://puredata.info/Members/rdz/software/slip/0.1~git20151118/slip-v0.1~git20151118-(Darwin-i386-32)(Darwin-x86_64-32)-externals.tar.gz")
ext_urls+=("http://puredata.info/Members/zmoelnigbot/software/zexy/2.3.1/zexy%5Bv2.3.1%5D(Darwin-amd64-32)(Linux-amd64-32)(Linux-arm64-32)(Linux-armv7-32)(Linux-i386-32)(Windows-amd64-32)(Windows-i386-32).dek")

# netpd bundle
netpd_bundle_url="https://www.netpd.org/~roman/netpd-plus-instruments.zip"

# workdir
work_dir=workdir

27
28
info_plist_replacements="
s/{DISPLAY_NAME}/${app_name}/
29
s/{EXECUTBALE}/Pd/
30
31
s/{ICON_FILES}/netpd.icns/
s/{BUNDLE_NAME}/${app_name}/
32
s/{BUNDLE_SHORT_VERSION}/${app_version}_${package_version}/
33
34
35
36
s/{SPOKEN_NAME}/${app_name}/
s/{BUNDLE_VERSION}/${netpd_version}/
"

Roman Haefeli's avatar
Roman Haefeli committed
37
38
39
40
41
42
43
function fail {
  echo "abort due some error"
  exit 1
}

# do stuff
(
44
45
46
47
  cd "$(dirname "$0")"
  (
    mkdir -p "${work_dir}"
    cd "${work_dir}"
Roman Haefeli's avatar
Roman Haefeli committed
48

49
    # install pd
Roman Haefeli's avatar
Roman Haefeli committed
50
    tar xf "${pd_archive_file}" || fail
51
    mv Pd-*.app "${app_bundle_name}" || fail
Roman Haefeli's avatar
Roman Haefeli committed
52

53
54
55
56
57
    # install externals
    (
      cd ${app_bundle_name}/Contents/Resources/extra
      for url in ${ext_urls[@]}
      do
58
        curl -s --fail -o file "${url}" || fail
59
60
        if file file | grep ' Zip archive data' > /dev/null
        then
Roman Haefeli's avatar
Roman Haefeli committed
61
          unzip -q file || fail
62
63
64
65
66
67
68
69
        fi
        if file file | grep 'gzip compressed data' > /dev/null
        then
          tar xf file || fail
        fi
        rm file || fail
      done
    ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
70

71
72
73
    # install netpd
    (
      cd ${app_bundle_name}/Contents/Resources
74
      curl --fail -s -o file "${netpd_bundle_url}" || fail
Roman Haefeli's avatar
Roman Haefeli committed
75
      unzip -q file && rm file || fail
76
    ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
77

78
  ) || fail
Roman Haefeli's avatar
Roman Haefeli committed
79

80
  # apply patch to load netpd at start
Roman Haefeli's avatar
Roman Haefeli committed
81
  patch -s ${work_dir}/${app_bundle_name}/Contents/Resources/tcl/pd-gui.tcl < files/pd-gui.tcl.patch || fail
82
  # copy icons file
83
  cp files/netpd.icns ${work_dir}/${app_bundle_name}/Contents/Resources/ || fail
84
  # construct a Info.plist
85
  sed -f <(echo "${info_plist_replacements}") files/Info.plist > ${work_dir}/${app_bundle_name}/Contents/Info.plist || fail
Roman Haefeli's avatar
Roman Haefeli committed
86
  # copy README
Roman Haefeli's avatar
Roman Haefeli committed
87
  cp files/README.txt "${work_dir}" || fail
88

89
  # create disk image
90
  genisoimage -quiet -V "${app_name}-${app_version}" -D -R -apple -no-pad -o "${app_name}-${app_version}_macos_${package_version}.dmg" "${work_dir}" || fail
Roman Haefeli's avatar
Roman Haefeli committed
91

Roman Haefeli's avatar
Roman Haefeli committed
92
  # put file online
93
  scp -q "${app_name}-${app_version}_macos_${package_version}.dmg" "all@netpd.org:public_html/software/" || fail
Roman Haefeli's avatar
Roman Haefeli committed
94

95
  # clean up
96
97
98
  rm -r "${work_dir}" "${app_name}-${app_version}_macos_${package_version}.dmg" || fail

  # create short cut
99
  ssh all@netpd.org ln -f -s "${app_name}-${app_version}_macos_${package_version}.dmg" "public_html/software/${app_name}-${app_version}_macos.dmg" || fail
100
)