build.sh 2.76 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
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# Pd
pd_archive_file=~/Downloads/pd-0.51-0test3.mac.tar.gz

# 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")
ext_urls+=("http://puredata.info/Members/porres/software/else/1.0beta27/else%5Bv1.0beta27%5D(Darwin-amd64-32).dek")
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
29
30
31
32
33
34
35
36
info_plist_replacements="
s/{DISPLAY_NAME}/${app_name}/
s/{EXECUTBALE}/${app_name}/
s/{ICON_FILES}/netpd.icns/
s/{BUNDLE_NAME}/${app_name}/
s/{BUNDLE_SHORT_VERSION}/${netpd_version} (${package_version})/
s/{SPOKEN_NAME}/${app_name}/
s/{BUNDLE_VERSION}/${netpd_version}/
"

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

# do stuff
(
  mkdir -p "${work_dir}"
  cd "${work_dir}"

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

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

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

)

# apply patch to load netpd at start
80
81
82
patch ${work_dir}/${app_bundle_name}/Contents/Resources/tcl/pd-gui.tcl < files/pd-gui.tcl.patch || fail
cp files/netpd.icns ${work_dir}/${app_bundle_name}/Contents/Resources/ || fail
sed -f <(echo "${info_plist_replacements}") files/Info.plist > ${work_dir}/${app_bundle_name}/Contents/Info.plist
Roman Haefeli's avatar
Roman Haefeli committed
83

84
echo "Done!"
Roman Haefeli's avatar
Roman Haefeli committed
85