File tcc.spec of Package tcc

#
# spec file for package tcc
#
# Copyright (c) 2024, 2025 Boian Berberov
#
# 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/
#

# Disable failing the build because these files have no build IDs
# %%{tccdir}/bcheck.o
# %%{tccdir}/bt-exe.o
# %%{tccdir}/bt-log.o
# %%{tccdir}/runmain.o
%if 41 < 0%{?fedora} || 9 < 0%{?mageia}
%global         debug_package  %{nil}
%else
#%%global         missing_build_ids_terminate_build  0
%endif

%global         up_name  tinycc
# TODO: host triplet and version slots
#global         tccdir   %%{_libdir}/%%{name}/%%{HOST_ARCH}-suse-linux
%global         tccdir   %{_libdir}/%{name}



Name:           tcc
Version:        0.9.27
Release:        0%{?dist}
Group:          Development/Languages/C and C++
Summary:        Tiny C Compiler
License:        LGPL-2.1-or-later
URL:            https://repo.or.cz/%{up_name}.git

Source0:        %{up_name}-%{version}.tar.gz

# BEGIN multibuild BuildRequires: GCC
%if 0%{?is_opensuse}
	%if 0%{?sle_version} <= 150600
		%if 0%{?sle_version} == 150600
BuildRequires:  gcc13
%global         multi_gcc  gcc-13
		%else
			%if 0%{?sle_version} == 150500
BuildRequires:  gcc12
%global         multi_gcc  gcc-12
			%else
BuildRequires:  gcc     >= 10
%global         multi_gcc  gcc
			%endif
		%endif
	%else
BuildRequires:  gcc
%global         multi_gcc  gcc
	%endif
%else
BuildRequires:  gcc
%global         multi_gcc  gcc
%endif
# END   multibuild BuildRequires: GCC

%if 0%{?is_opensuse} || 0%{?mageia}
BuildRequires:  makeinfo
%else
BuildRequires:  texinfo
%endif

Requires:       libtcc == %{version}

%description
Tiny C Compiler



%package -n libtcc
Summary:        Tiny C Compiler library

%description -n libtcc
Tiny C Compiler library



%package -n libtcc-devel
Summary:        Tiny C Compiler library headers

%description -n libtcc-devel
Tiny C Compiler library headers



%prep
%setup -q -n %{up_name}-%{version}



%build
%if 0%{?rhel_version} < 800 || 0%{?centos_version} < 800
export CFLAGS='%{optflags}'
%else
%set_build_flags
%endif

%ifarch %ix86
export CFLAGS="${CFLAGS} -m32"
%endif

# Set proper GCC
export CC='%{multi_gcc}'

%if 0%{?fedora}
export LDFLAGS="%{build_ldflags} -fPIC"
%endif

# Ordered based on `configure` --help
./configure \
%ifarch %ix86
	--cpu=i686 \
%endif
	--prefix=%{_prefix} \
	--exec-prefix=%{_exec_prefix} \
	--bindir=%{_bindir} \
	--libdir=%{_libdir} \
	--tccdir=%{tccdir} \
	--includedir=%{_includedir} \
	--sharedir=%{_datadir} \
	--docdir=%{_defaultdocdir}/%{name} \
	--mandir=%{_mandir} \
	--infodir=%{_infodir} \
	--disable-static \
	--disable-rpath \
	--config-dwarf=5

# Show config.mak
%__cat config.mak

%make_build



%install
%make_install CONFIG_strip=no



%files
%license COPYING RELICENSING
%doc     README
%{_bindir}/%{name}
%dir     %{tccdir}
%{tccdir}/libtcc1.a
%{tccdir}/bcheck.o
%{tccdir}/bt-exe.o
%{tccdir}/bt-log.o
%{tccdir}/runmain.o
%dir     %{tccdir}/include
%{tccdir}/include/float.h
%{tccdir}/include/stdalign.h
%{tccdir}/include/stdarg.h
%{tccdir}/include/stdatomic.h
%{tccdir}/include/stdbool.h
%{tccdir}/include/stddef.h
%{tccdir}/include/stdnoreturn.h
%{tccdir}/include/tccdefs.h
%{tccdir}/include/tcclib.h
%{tccdir}/include/tgmath.h
%{tccdir}/include/varargs.h
%{_docdir}/%{name}/%{name}-doc.html
%{_infodir}/%{name}-doc.info.*
%{_mandir}/man1/%{name}.1.*



%files -n libtcc
%{_libdir}/libtcc.so



%files -n libtcc-devel
%{_includedir}/libtcc.h



%changelog

* Tue Jul 15 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by