File tcc.spec of Package tcc

Name: tcc
%define libname lib%name
Version: 0.9.27
Release: 16
Summary: Tiny and Fast C Compiler
License: LGPL-2.0+
Group: Development/Languages/C and C++
Source3: %name-rpmlintrc
Patch0: %name-%version-git.patch
Patch1: %name-0.9.27-ignore-opt.patch
BuildRequires: makeinfo
Requires(post): info
Requires(preun): info
ExcludeArch: ppc ppc64 ppc64le

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: Documentation
Requires: %name = %version-%release
BuildArch: noarch

%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
BuildArch: noarch

%description devel
This package contains all necessary include files and libraries needed to
develop applications that require these.

%setup -q
sed -i 's/\r$//g' win32/{build-tcc.bat,tcc-win32.txt}
%patch0 -p1
%patch1 -p1 -F1
sed -i '1s|^#!/usr/local/bin/|#!%_bindir/|' examples/*

# note that tcc does not use autotools
%configure \
	--extra-cflags="%optflags" \
	--extra-ldflags="-ldl" \
	--with-selinux \
	--docdir=%_datadir/doc/%name \
	--disable-static \
make %{?_smp_mflags} TCC="env LD_PRELOAD=$PWD/ $PWD/tcc"

gzip -9c Changelog > Changelog.gz

rm -rf %buildroot%_datadir/doc/%name
chmod 644 %buildroot%_mandir/man1/%name.1* %buildroot%_infodir/*

install -d -m 0755 %buildroot%_docdir/%name
cp -a examples %buildroot%_docdir/%name/
install -m 0644 Changelog.* README TODO *.html %buildroot%_docdir/%name/

%if 0

%install_info --info-dir=%_infodir %_infodir/

%install_info_delete --info-dir=%_infodir %_infodir/

%post -n %libname -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig


%files -n %{libname}

%files doc
%defattr(-, root, root,)
%doc %_docdir/%name

%files devel
%defattr(-, root, root, -)

openSUSE Build Service is sponsored by