5c20763
# Add --with pcc option to build with pcc (for sanity testing the compiler)
5c20763
%bcond_with pcc
5c20763
3bb0a4b
# Use our own configure in order to prevent --target, which makes autotools believe we are cross compiling
ebf7ed0
%global pccconfigure \
3bb0a4b
 export CFLAGS="${FLAGS}"; \
3bb0a4b
 export CXXFLAGS="${FLAGS}"; \
3bb0a4b
 export FFLAGS="${FLAGS} -I%{_fmoddir}"; \
226e09a
 ./configure --program-prefix= --prefix=%{_prefix} --exec-prefix=%{_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir}
ebf7ed0
5c20763
# Used CVS snapshot
3c9ee20
%global snapshot 20200203
5c20763
3bb0a4b
# RPM does not play well with pcc compiled package
5c20763
%if %{with pcc}
3bb0a4b
%define debug_package %{nil}
3bb0a4b
%endif
3bb0a4b
3bb0a4b
# Release tag
87a668c
%define rel 1.1.%{snapshot}cvs
661e385
4a0e291
Name:           pcc
4a0e291
Version:        1.1.0
5c20763
5c20763
%if %{with pcc}
f5a7492
Release:        %{rel}_pcc%{?dist}.9
3bb0a4b
%else
f5a7492
Release:        %{rel}%{?dist}.9
3bb0a4b
%endif
5c20763
4a0e291
Summary:        The Portable C Compiler
4a0e291
License:        BSD with advertising and BSD and ISC 
4a0e291
URL:            http://pcc.ludd.ltu.se/
4a0e291
Source0:        http://pcc.ludd.ltu.se/ftp/pub/pcc/pcc-%{snapshot}.tgz
4a0e291
Source1:        http://pcc.ludd.ltu.se/ftp/pub/pcc-libs/pcc-libs-%{snapshot}.tgz
686a555
# Patch to disable the use of -g in pcc-libs/csu/linux/ which is partly assembler code.
686a555
# Also, inlineing is disabled because it will break the code.
686a555
# Also, remove default -O flag from the code.
4a0e291
Patch0:         pcc-20141210-flags.patch
661e385
b4dd7f3
# Currently only x86 and x86_64 supported both in ppc and ppc-libs
4a0e291
ExclusiveArch:  %{ix86} x86_64
dc685da
BuildRequires: make
4a0e291
BuildRequires:  bison
4a0e291
BuildRequires:  flex
4a0e291
Requires:       glibc-devel
661e385
5c20763
%if %{with pcc}
4a0e291
BuildRequires:  pcc
4a0e291
%else
4a0e291
BuildRequires:  gcc
3bb0a4b
%endif
3bb0a4b
661e385
%description
686a555
The compiler is based on the original Portable C Compiler by Stephen
686a555
C. Johnson, written in the late 70's. Even though much of the
686a555
compiler has been rewritten, some of the basics still remain.
686a555
686a555
PCC debuted in Unix Version 7 and replaced the DMR compiler (Dennis
686a555
Ritchie's original C compiler) in both System V and the BSD 4.x
686a555
releases. Some history about pcc is in the A History of UNIX before
686a555
Berkeley: UNIX Evolution: 1975-1984 and in the Evolution of C.
686a555
686a555
About 50% of the front-end code and 80% of the back-end code has been
686a555
rewritten.  Most stuff is written by Anders Magnusson, with the
686a555
exception of the data-flow analysis part and the SSA conversion code
686a555
which is written by Peter A. Jonsson, and the Mips port that were
686a555
written as part of a project by undergraduate students at LuleƄ
686a555
University of Technology (LTU).
3bb0a4b
661e385
%prep
5c20763
%setup -q -n pcc-%{snapshot} -a1
686a555
# Rename the libs directory
5c20763
mv pcc-libs-%{snapshot} pcc-libs
661e385
686a555
# Apply patches
686a555
%patch0 -p1 -b .flags
661e385
661e385
%build
b4dd7f3
# Set architecture directory needed for include flag
b4dd7f3
%ifarch x86_64
b4dd7f3
export archdir=amd64
b4dd7f3
%endif
b4dd7f3
%ifarch %{ix86}
b4dd7f3
export archdir=i386
b4dd7f3
%endif
b4dd7f3
3bb0a4b
# Use pcc to build?
5c20763
%if %{with pcc}
686a555
export FLAGS="-g -O"
3bb0a4b
export CC="pcc"
3bb0a4b
export CPP="pcc -E"
3bb0a4b
%else
3bb0a4b
export FLAGS="%{optflags}"
3bb0a4b
export CC="gcc"
3bb0a4b
export CPP="gcc -E"
3bb0a4b
%endif
3bb0a4b
3bb0a4b
# Flags for files that can't be built as debug
686a555
export CFLAGS_NODEBUG=`echo ${FLAGS} -fno-inline|sed "s| -g | |g"`
3bb0a4b
661e385
# First, build the library.
661e385
cd pcc-libs
b4dd7f3
%pccconfigure
3bb0a4b
make CFLAGS="-I${archdir} -Ilinux -I. ${FLAGS}" CFLAGS_NODEBUG="-I${archdir} -Ilinux -I. $CFLAGS_NODEBUG" 
226e09a
#%{?_smp_mflags}
661e385
cd ..
661e385
# Then, build the compiler
b4dd7f3
%pccconfigure --with-assembler=%{_bindir}/as --with-linker=%{_bindir}/ld \
686a555
 --with-libdir=%{_libdir} --with-incdir=%{_includedir} --enable-tls \
686a555
 --disable-stripping
226e09a
make 
226e09a
#%{?_smp_mflags}
661e385
661e385
661e385
%install
661e385
rm -rf %{buildroot}
661e385
# Install the libraries
686a555
make -C pcc-libs install DESTDIR=%{buildroot}
661e385
# Install the compiler
686a555
make install DESTDIR=%{buildroot}
661e385
# Fix man file perms
661e385
chmod 644 %{buildroot}%{_mandir}/man1/*
b4dd7f3
# Rename cpp man page
b4dd7f3
mv  %{buildroot}%{_mandir}/man1/{,pcc-}cpp.1
661e385
# Directory for pcc-specific include files
661e385
mkdir -p %{buildroot}%{_includedir}/pcc
661e385
7ab7ea5
# Replace identical copied binary with hardlink
7ab7ea5
cd %{buildroot}%{_bindir}
7ab7ea5
if diff pcc pcpp > /dev/null; then
7ab7ea5
   ln -f pcc pcpp
7ab7ea5
fi
7ab7ea5
661e385
%files
661e385
%{_bindir}/pcc
87a668c
%{_bindir}/p++
686a555
%{_bindir}/pcpp
661e385
%{_libdir}/pcc/
661e385
%{_includedir}/pcc/
b4dd7f3
%{_libexecdir}/cpp
686a555
%{_libexecdir}/cxxcom
b4dd7f3
%{_libexecdir}/ccom
b4dd7f3
%{_mandir}/man1/ccom.1.*
ebf7ed0
%{_mandir}/man1/pcc-cpp.1.*
ebf7ed0
%{_mandir}/man1/pcc.1.*
87a668c
%{_mandir}/man1/p++.1.*
87a668c
%{_mandir}/man1/pcpp.1.*
661e385
661e385
%changelog
f5a7492
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.9
f5a7492
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
f5a7492
124990e
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.8
124990e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
124990e
5af321c
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.7
5af321c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
5af321c
112b03d
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.6
112b03d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
112b03d
ea4b7a8
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.5
ea4b7a8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
ea4b7a8
8882574
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.4
8882574
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
8882574
b3af284
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.3
b3af284
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
b3af284
78f8f6c
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.2
78f8f6c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
78f8f6c
3dc359f
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20200203cvs.1
3dc359f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
3dc359f
3c9ee20
* Tue Feb 04 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20200203cvs
3c9ee20
- Update to 20200203 snapshot.
3c9ee20
e8ccbd3
* Sun Feb 02 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20200201cvs
e8ccbd3
- Update to 20200201 snapshot.
e8ccbd3
c0614e8
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20180504cvs.4
c0614e8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
c0614e8
28f7b32
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20180504cvs.3
28f7b32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
28f7b32
7985ff6
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20180504cvs.2
7985ff6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
7985ff6
6271bfc
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20180504cvs.1
6271bfc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
6271bfc
2e6db62
* Fri May 04 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20180504cvs
2e6db62
- Update to 20180504 snapshot, fixing BZ #1551537.
2e6db62
4a0e291
* Wed Feb 28 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20180228cvs
4a0e291
- Update to 20180228 snapshot.
4a0e291
- Added gcc buildrequires.
4a0e291
1fea109
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20161201cvs.4
1fea109
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
1fea109
f4ec373
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20161201cvs.3
f4ec373
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
f4ec373
1241ede
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20161201cvs.2
1241ede
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
1241ede
af6d5d2
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20161201cvs.1
af6d5d2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
af6d5d2
d134289
* Thu Dec 01 2016 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20161201cvs
d134289
- Update to 20161201 snapshot.
d134289
4823eee
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-1.1.20160115cvs.1
4823eee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
4823eee
4ee4fa7
* Fri Jan 15 2016 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20160115cvs
4ee4fa7
- Update to 20160115 snapshot.
4ee4fa7
87a668c
* Thu Dec 31 2015 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.1.20151231cvs
87a668c
- Update to 20151231 snapshot.
87a668c
2371aee
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-1.0.20141210cvs.1
2371aee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
2371aee
2a435e3
* Wed Dec 10 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-1.0.20141210cvs
2a435e3
- Update to 20141210, the PCC 1.1.0 release.
2a435e3
7ab7ea5
* Sun Aug 17 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-0.1.20140817cvs
7ab7ea5
- Update to 20140817.
7ab7ea5
b99fd6e
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-0.2.20140420cvs.1
b99fd6e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
b99fd6e
a965ebc
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-0.1.20140420cvs.1
a965ebc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
a965ebc
686a555
* Sun Apr 20 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.0-0.1.20140420cvs
686a555
- Disable inlining in low level functions where it should not be done.
686a555
- Update to newest CVS release.
686a555
0fe1352
* Mon Aug 19 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.0.0-3.20111216cvs
0fe1352
- Fix FTBFS on rawhide.
0fe1352
413dba9
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2.20111216cvs.2
413dba9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
413dba9
867f253
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2.20111216cvs.1
867f253
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
867f253
b21cdc4
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2.20111216cvs
b21cdc4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b21cdc4
bbf8771
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2.20111216cvs
bbf8771
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
bbf8771
5c20763
* Fri Dec 16 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.0-2.20111216cvs
5c20763
- Use cvs checkout once again, fixing BZ #708305.
5c20763
a2ce166
* Fri Apr 01 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.0-1
a2ce166
- Switch to using stable releases.
a2ce166
- Update to 1.0.
a2ce166
f0cf778
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.9-0.4.20110203cvs
f0cf778
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
f0cf778
24474c8
* Thu Feb 03 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.4.20110203cvs
24474c8
- Update to 20110203.
24474c8
3bb0a4b
* Fri Nov 19 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.4.101119cvs
3bb0a4b
- Update to 20101119. x86_64 works now.
3bb0a4b
- Added possibility in the spec file to build pcc with itself.
3bb0a4b
226e09a
* Wed Apr 14 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.4.100413cvs
226e09a
- Update to 20100413.
226e09a
b4dd7f3
* Sun Aug 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.4.090816cvs
b4dd7f3
- Update to 20090816, adding support for x86_64.
b4dd7f3
- Use own configure macro to disable cross compilation.
b4dd7f3
661e385
* Thu Aug 13 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.3.090813cvs
661e385
- Removed unneeded BR: byacc.
661e385
- Update to 20090813.
661e385
661e385
* Tue Aug 11 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.2.090811cvs
661e385
- Spec file cleanups.
661e385
- Update to 20090811.
661e385
661e385
* Sun Aug 09 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.2.090809cvs
3bb0a4b
- Changed --with-libdir to %%{_libdir} to make pcc use the glibc version of
3bb0a4b
  crt0.o by suggestion of upstream.
661e385
- Update to 20090809.
661e385
661e385
* Sat Aug 08 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.9.9-0.1.090808cvs
661e385
- First release.