File 9cc.spec of Package 9cc

#
# spec file for package 9cc
#
# 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 http://bugs.opensuse.org/
#


Name:           9cc
Version:        
Release:        0
Summary:        A small C compiler
License:        MIT
Group:          Development/Languages/C and C++
URL:            https://github.com/rui314/9cc
Source0:        %{name}-%{version}.tar.xz
%ifarch x86_64
BuildRequires:  glibc-devel-static
%endif

%description
9cc is a successor of the 8cc C compiler. It's written in such a way to
be easily understood while generating reasonably efficient assembly.

9cc has more stages than 8cc. Here is an overview of the internals:

 * Compiles an input string to abstract syntax trees.
 * Runs a semantic analyzer on the trees to add a type to each tree node.
 * Converts the trees to intermediate code (IR), which in some degree
   resembles x86-64 instructions but has an infinite number of registers.
 * Maps an infinite number of registers to a finite number of registers.
 * Generates x86-64 instructions from the IR.

%prep
%autosetup

%build
%if 0%{?sle_version} <= 120300
export EFLAGS="-std=c99"
%endif
make %{?_smp_mflags} CFLAGS="$EFLAGS %{optflags}"

%install
install -Dm0755 9cc %{buildroot}%{_bindir}/%{name}

%ifarch x86_64
%check
make test
%endif

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}

%changelog
openSUSE Build Service is sponsored by