File flutter.spec of Package flutter

#
# spec file for package flutter
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define install_dir %{_datadir}/flutter

Name:           flutter
Version:        3.16.0+0
Release:        0
Summary:        Google's SDK for creating multi platform apps
License:        BSD-3-Clause
URL:            https://github.com/flutter/flutter
Group:          Development/Tools/Other
Source:         %{name}-%{version}.tar.xz
Source1:        pub-cache.tar.xz
BuildRequires:  git
Requires:       coreutils
Requires:       bash
Requires:       curl
Requires:       file
Requires:       git
Requires:       unzip
Requires:       which
Requires:       xz
Requires:       zip

%description
Flutter is Google's SDK for crafting beautiful, fast user experiences for
mobile, web, and desktop from a single codebase. Flutter works with existing
code, is used by developers and organizations around the world, and is free
and open source.

%prep
%setup -q -n %{name}-%{version}
tar -xf %{SOURCE1} -C ./

%build
git config --local --add safe.directory /usr/share/flutter

%install
install -d -m 0755 %{buildroot}%{install_dir}
install -d -m 0755 %{buildroot}%{_bindir}
cp -ra ./. %{buildroot}%{install_dir}
ln -s %{install_dir}/bin/dart %{buildroot}%{_bindir}
ln -s %{install_dir}/bin/flutter %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
echo "FLUTTER_GIT_URL=\"unknown source\"" > %{buildroot}%{_sysconfdir}/profile.d/flutter.sh
echo "PUB_CACHE=%{install_dir}/pub-cache" >> %{buildroot}%{_sysconfdir}/profile.d/flutter.sh

%post
chmod -R g+w,o+w %{install_dir}
# flutter precache || true
# flutter doctor || true

%files
%doc README.md LICENSE
%{_bindir}/dart
%{_bindir}/flutter
%{install_dir}
%{_sysconfdir}/profile.d/flutter.sh

%changelog

openSUSE Build Service is sponsored by