File dart.spec of Package dart

#
# spec file for package dart
#
# Copyright (c) 2025 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 depot_tools_commit_hash c994f00deea05fc327fb272f3bef8d626343ee72

Name:           dart
Version:        3.7.0
Release:        0
Summary:        The dart programming language SDK
License:        BSD-3-Clause
URL:            https://dart.dev
Source0:        https://github.com/dart-lang/sdk/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://chromium.googlesource.com/chromium/tools/depot_tools.git/+archive/%{depot_tools_commit_hash}.tar.gz#/depot_tools-%{depot_tools_commit_hash}.tar.gz
Source2:        gclient_sync.tar.gz
Source3:        gclient_sync_tools.tar.gz
# Taken from the arch package at https://gitlab.archlinux.org/archlinux/packaging/packages/dart/-/blob/1d629ea1a4ba47c1c402047ebcd632cfe52f5c83/DEPS.patch.
Patch0:         DEPS.patch
BuildRequires:  gn
BuildRequires:  python3
BuildRequires:  ninja

%description
dart

%prep
cat > .gclient <<EOF
solutions = [
  {
    "name": "sdk",
    "url": "file://%{build}/sdk",
    "deps_file": "DEPS",
    "managed": False,
    "custom_deps": {},
    "custom_vars": {},
  },
]
EOF

%autosetup -p1 -n sdk-%{version}
mkdir -p depot_tools
tar xf %{SOURCE1} -C depot_tools

tar xf %{SOURCE2} --strip-components 1

sed -i 's|prefix = "x86_64-linux-gnu-"|prefix = ""|g' build/toolchain/linux/BUILD.gn

%build
# Do not use tabs for the --args string, it will fail.
gn gen -qv out --args='
  target_cpu = "x64"
  is_debug = false
  is_release = true
  is_clang = false
  dart_platform_sdk = false
  verify_sdk_hash = false'
ninja create_sdk -v -C out

%install

%check

%files
%license LICENSE
%doc README.md CHANGELOG.md

%changelog

openSUSE Build Service is sponsored by