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++
Url: http://bellard.org/%name/
Source0: http://download.savannah.nongnu.org/releases/tinycc/%name-%version.tar.xz
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

%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: 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.


%prep
%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/*


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

gzip -9c Changelog > Changelog.gz


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

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
%check
LD_LIBRARY_PATH=$PWD make test
%endif


%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,-)
%_mandir/man1/*
%_infodir/*
%_bindir/*
%_libdir/%name/


%files -n %{libname}
%defattr(-,root,root,-)
%_libdir/*.so


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


%files devel
%defattr(-, root, root, -)
%_includedir/libtcc.h


%changelog
openSUSE Build Service is sponsored by