summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ca89756dad87a4232867bb16159eb31f2c6b9e6 (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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Mantainer: Daniele Basso <d dot bass05 at proton dot me>
# Contributor: Fredy GarcĂ­a <frealgagu at gmail dot com>
# Contributor: Philip Goto <philip.goto@gmail.com>, WithTheBraid <the-one@with-the-braid.cf>

pkgname=('flutter-light' 'flutter-light-android-arm' 'flutter-light-android-arm64' 'flutter-light-android-x86' 'flutter-light-android-x64' 'flutter-light-web' 'flutter-light-linux')
pkgbase=flutter-light
pkgver=3.10.6
pkgrel=1
makedepends=("python")
optdepends=("android-sdk" "android-studio" "intellij-idea-community-edition" "intellij-idea-ultimate-edition" "cmake" "ninja" "perl" "python")

arch=("x86_64" "aarch64")
url="https://flutter.dev"
license=("custom" "BSD" "CCPL")
options=("emptydirs" "!strip")
source=(
  "flutter.sh"
)

sha256sums=('1c161f30aabf34e25d9399a79973bdd457bedd6c6f6ffcc5152f8965aa8eb568')

prepare() {
  if [ ! -e $srcdir/flutter ]; then
    git clone https://github.com/flutter/flutter.git --depth 1 -b stable
  fi
  cd $srcdir/flutter
  git clean -dfx
  _ver=$(git tag -l)
  if [[ $_ver != $pkgver  ]]; then
	git pull --update-shallow
  fi
  _ver=$(git tag -l | grep $pkgver)
  if [[ $_ver != $pkgver  ]]; then
  	exit 1
  fi
  sed -i "/\"\$FLUTTER_ROOT\/bin\/internal\/update_dart_sdk.sh\"/d" "${srcdir}/flutter/bin/internal/shared.sh"
  mkdir -p "${srcdir}/flutter/bin/cache/"
  ln -sf "/opt/dart-sdk" "${srcdir}/flutter/bin/cache/"
  "${srcdir}/flutter/bin/flutter" --no-version-check precache
}

package_flutter-light() {
  provides=(flutter)
  conflicts=(flutter)
  depends=("git" "glu" "java-environment>=8" "libglvnd" "unzip" "dart" "flutter-light-android-arm64" "dart")
  arch=("x86_64" "aarch64")
  backup=("opt/flutter/packages/flutter_test/pubspec.yaml" "opt/flutter/packages/flutter/pubspec.yaml")
  pkgdesc="A new mobile app SDK to help developers and designers build modern mobile apps for iOS and Android. Using the dart package provided by Arch devs (slower updates)"
  
  install -Dm644 "${srcdir}/flutter/LICENSE" "${pkgdir}/usr/share/licenses/flutter/LICENSE"
  install -Dm755 "${srcdir}/flutter.sh" "${pkgdir}/usr/bin/flutter"
  install -dm755 "${pkgdir}/opt/flutter"
  install -dm755 "${pkgdir}/usr/bin"
  cp -ra "${srcdir}/flutter" "${pkgdir}/opt/"
  rm -rf ${pkgdir}/opt/flutter/bin/cache/artifacts/engine/{android*,linux*} ${pkgdir}/opt/flutter/bin/cache/flutter_web_sdk

  # version overriding, something broken; not my fault *grumble*
  echo "${pkgver}" > "${pkgdir}/opt/flutter/version" 
  find "${pkgdir}/opt/flutter" -type d -exec chmod a+rx {} +
  find "${pkgdir}/opt/flutter" -type f -exec chmod a+r {} +

  # those files *must* be read-write for end-users; not my fault *grumble*
  chmod a+rw "${pkgdir}/opt/flutter"
  chmod -R a+rw "${pkgdir}/opt/flutter/version" "${pkgdir}/opt/flutter/bin/cache" "${pkgdir}/opt/flutter/.git"
  find "${pkgdir}/opt/flutter" -name "pubspec.lock" -exec chmod a+rw {} +
  find "${pkgdir}/opt/flutter" -name "package_config.json" -exec chmod a+rw {} +
  find "${pkgdir}/opt/flutter" -name "package_config.json" -exec chmod a+rw {} +
}

package_flutter-light-android-arm() {
  depends=("flutter-light")
  
  install -dm755 "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra "${srcdir}/flutter/bin/cache/artifacts/engine/android-arm" "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra ${srcdir}/flutter/bin/cache/artifacts/engine/android-arm-* ${pkgdir}/opt/flutter/bin/cache/artifacts/engine
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
}

package_flutter-light-android-arm64() {
  depends=("flutter-light")
  
  install -dm755 "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra ${srcdir}/flutter/bin/cache/artifacts/engine/android-arm64* ${pkgdir}/opt/flutter/bin/cache/artifacts/engine
  
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
}

package_flutter-light-android-x86() {
  depends=("flutter-light")

  install -dm755 "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra ${srcdir}/flutter/bin/cache/artifacts/engine/android-x86* ${pkgdir}/opt/flutter/bin/cache/artifacts/engine
  
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
}

package_flutter-light-android-x64() {
  depends=("flutter-light")

  install -dm755 "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra ${srcdir}/flutter/bin/cache/artifacts/engine/android-x64 ${pkgdir}/opt/flutter/bin/cache/artifacts/engine
  
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
}

package_flutter-light-web() {
  depends=("flutter-light")

  install -dm755 "${pkgdir}/opt/flutter/bin/cache"
  cp -ra "${srcdir}/flutter/bin/cache/flutter_web_sdk" "${pkgdir}/opt/flutter/bin/cache"
  
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/flutter_web_sdk"
}

package_flutter-light-linux() {
  depends=("flutter-light")

  install -dm755 "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
  cp -ra ${srcdir}/flutter/bin/cache/artifacts/engine/linux* ${pkgdir}/opt/flutter/bin/cache/artifacts/engine
  
  chmod -R a+rw "${pkgdir}/opt/flutter/bin/cache/artifacts/engine"
}