File flutter-sdk.spec of Package flutter

#
# spec file for package flutter-sdk
#
# 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 installdir %{_datadir}/flutter
%define archivename flutter

Name:           flutter-sdk
Version:        3.22.1+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:         %{archivename}-%{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
# Requires to build Linux App
Requires:       clang, cmake, ninja, gtk3-devel

BuildRoot:      %{archivename}-%{version}

%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 %{archivename}-%{version}
tar -xf %{SOURCE1} -C ./

%build

%install
install -d -m 0755 %{buildroot}%{installdir}
install -d -m 0755 %{buildroot}%{_bindir}
cp -ar ./* ./.git* %{buildroot}%{installdir}
ls -la %{buildroot}%{installdir}
ln -s %{installdir}/bin/dart %{buildroot}%{_bindir}
ln -s %{installdir}/bin/flutter %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
echo "export FLUTTER_GIT_URL=\"unknown source\"" > %{buildroot}%{_sysconfdir}/profile.d/flutter.sh
echo "export PUB_CACHE=%{installdir}/pub-cache" >> %{buildroot}%{_sysconfdir}/profile.d/flutter.sh

%post
chmod -R g+w,o+w %{installdir}
git config --global --add safe.directory %{installdir}
# flutter precache || true
# flutter doctor || true

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

%changelog

openSUSE Build Service is sponsored by