build_windows.sh 2.92 KB
Newer Older
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash

app_name="netpd"
app_version="2.2"
package_version=$(date +%Y-%m-%d)

# Pd
pd_archive_file=~/Downloads/pd-0.51-0.msw.zip

# Libraries
ext_urls=()
ext_urls+=("http://puredata.info/Members/rdz/software/binfile/0.1~git20181006/binfile%5Bv0.1~git20181006%5D(Windows-amd64-32).dek")
ext_urls+=("https://netpd.org/~roman/else%5Bv1.0beta27%5D(Windows-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(Windows-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/rdz/software/osc/0.2~git20181006/osc%5Bv0.2~git20181006%5D(Windows-amd64-32).dek")
ext_urls+=("http://puredata.info/Members/rdz/software/slip/0.1~git20181006/slip%5Bv0.1~git20181006%5D(Windows-amd64-32).dek")
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="${app_name}-${app_version}"

function fail {
  echo "abort due some error"
  exit 1
}

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

    # install pd
    unzip -q "${pd_archive_file}" || fail
    mv pd-0.*-* pd-netpd || fail

    # install externals
    (
      cd pd-netpd/extra
      for url in ${ext_urls[@]}
      do
        curl -s -o file "${url}" || fail
        if file file | grep ' Zip archive data' > /dev/null
        then
          unzip -q file || fail
        fi
        if file file | grep 'gzip compressed data' > /dev/null
        then
          tar xf file || fail
        fi
        rm file || fail
      done
    ) || fail

    # install netpd
    (
      cd pd-netpd
      curl -s -o file "${netpd_bundle_url}" || fail
      unzip -q file && rm file || fail
      mv netpd/instruments .. || fail
    ) || fail

  ) || fail

  # apply patch to load netpd at start
  patch -s ${work_dir}/pd-netpd/tcl/pd-gui.tcl < files/pd-gui.tcl.patch || fail
  # fix instruments path in preferences
  patch -s ${work_dir}/pd-netpd/netpd/includes/netpd-preferences.cnf < files/netpd-preferences.cnf.patch || fail
  # copy launcher exe
  cp files/netpd.exe "${work_dir}" || fail
  # copy README
  cp files/README.txt.win "${work_dir}/README.txt" || fail
  # create version file
  echo "${app_version} (${package_version})" > "${work_dir}/VERSION.txt"

  # create archive
  zip -q -r "${app_name}-${app_version}_windows_${package_version}.zip" "${app_name}-${app_version}"

  # upload bundle
  scp -q "${app_name}-${app_version}_windows_${package_version}.zip" all@netpd.org:public_html/software/

  # clean up
  rm -rf "${work_dir}" ""${app_name}-${app_version}_windows_${package_version}.zip""
)