File gn.spec of Package gn

# spec file for package gn
# Copyright (c) 2020 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

Name:           gn
Version:        0.1726
Release:        0
Summary:        A meta-build system that generates build files for Ninja
License:        BSD-3-Clause
Patch0:         gn-flags.patch
Patch1:         gn-always-python3.patch
BuildRequires:  gcc-c++
BuildRequires:  ninja
BuildRequires:  python3-base
%if 0%{?suse_version} < 1500
BuildRequires:  gcc7-c++

GN is a meta-build system that generates build files for Ninja.

%setup -q
%patch0 -p1
%patch1 -p1

export CC=gcc
export CXX=g++
export AR=ar
%if 0%{?suse_version} < 1500
export CC=gcc-7
export CXX=g++-7
export CXXFLAGS="%{optflags}"
# bootstrap
python3 build/ \
  --no-strip \
  --no-last-commit-position \
cat >out/last_commit_position.h <<-EOF
%ninja_build -C out gn

%ninja_build -C out gn_unittests

install -Dm 0755 out/%{name} %{buildroot}%{_bindir}/%{name}

%license LICENSE