File tcc.spec of Package tcc
#
# spec file for package tcc
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2010 Guido Berhoerster.
#
# 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/
#
%define libname libtcc1_0
Name: tcc
Version: 0.9.27
Release: 0
Summary: Tiny and Fast C Compiler
License: LGPL-2.1-or-later AND MIT
Group: Development/Languages/C and C++
Url: http://bellard.org/tcc/
Source0: http://download.savannah.nongnu.org/releases/tinycc/%{name}-%{version}.tar.bz2
Source1: %{name}-rpmlintrc
# Build shared and static libraries -- Arachnos
Patch0: 0001-Build-shared-and-static-libraries.patch
BuildRequires: makeinfo
Requires(post): info
Requires(preun): info
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: ppc ppc64 ppc64le
%description
The Tiny C Compline (TCC) is a small but very fast C compiler. Unlike other C
compilers, it is meant to be self-reliant and thus does not need an external
assembler or linker. It supports ANSI C, most of the ISO C99 standard and many
GNUC extensions including inline assembly and it can automatically generate
memory and bound checks while allowing all C pointers operations.
Pieces of C source code may also be executed as a script with TCC, due to its
high compilation speed performance will be equivalent to that of an executable.
Through libtcc TCC can be used as a backend for dynamic code generation.
%package -n %{libname}
Summary: Dynamic Code Generation Backend Library
Group: System/Libraries
%description -n %{libname}
This package provides the tcc shared library that can be used as a dynamic code
generation backend.
%package doc
Summary: Documentation for tcc
Group: Development/Languages/C and C++
Requires: %{name} = %{version}-%{release}
%description doc
This package contains the documentation for tcc.
%package devel
Summary: Include Files and Libraries mandatory for Development
Group: Development/Languages/C and C++
Requires: %{name} = %{version}-%{release}
%description devel
This package contains all necessary include files and libraries needed to
develop applications that require these.
%prep
%setup -q
%autopatch -p1
find examples/ -type f -exec \
sh -c 'sed "s|#!%{_prefix}/local/bin/|#!%{_bindir}/|" "$1" >"$1.tmp" && mv "$1.tmp" "$1"' \
'' {} \;
# Fix "bcheck.c:738: error: '__malloc_hook' undeclared" for Tumbleweed
%if 0%{?suse_version} >= 1550
sed -i 's/#define CONFIG_TCC_MALLOC_HOOKS/#undef CONFIG_TCC_MALLOC_HOOKS/' lib/bcheck.c
sed -i 's/#define HAVE_MEMALIGN/#undef HAVE_MEMALIGN/' lib/bcheck.c
%endif
%build
# note that tcc does not use autotools
%configure \
--disable-static \
--disable-rpath
make %{?_smp_mflags}
%install
%make_install
rm -rf %{buildroot}%{_datadir}/doc
chmod 644 %{buildroot}%{_mandir}/man1/tcc.1* \
%{buildroot}%{_infodir}/%{name}-doc.info*
%check
#make test
%post
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}-doc.info.gz
%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}-doc.info.gz
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc COPYING RELICENSING
%{_mandir}/man1/tcc.1*
%{_infodir}/%{name}-doc.info.gz
%{_bindir}/tcc
%{_libdir}/tcc/
%files -n %{libname}
%defattr(-,root,root,-)
%doc COPYING RELICENSING
%{_libdir}/libtcc.so.1*
%files doc
%defattr(-, root, root, -)
%doc Changelog README TODO tcc-doc.html examples
%files devel
%defattr(-, root, root, -)
%{_includedir}/libtcc.h
%{_libdir}/libtcc.so
%changelog