File gpc.spec of Package gpc
################# Copyright (c) 2012-2016 Trevor Blight #######################
#
# spec file for gnu pascal compiler package
#
# 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 each 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.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# gpc now uses GPL version 3
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define debug_package %{nil}
# most recent reccommended version of gcc
%define GCC_VERSION 3.4.6
%define GPC_VERSION 20070904
%if 0%{?rhel_version} == 0 || 0%{?rhel_version} >= 500
# add --without appWizard option to disable building kdevelop4 app wizard
# eg
# rpmbuild -ba gpc.spec --without appWizard
# otherwise it's built by default
%bcond_without appWizard
%if %{with appWizard}
# disable for now, problems with kde-filesystem
%define doAppWizard 0
%endif
%endif
%if 0%{?mgaversion} != 0
%undefine doAppWizard
%{echo:"mageia detected, omitting app wizard (%{?doAppWizard})"}
%endif
%if 0%{?opensuse_bs}
# opensuse build service does not provide kde for these versions
# so skip build kdevelop app wizard
%if 0%{?centos_version} == 505
%undefine doAppWizard
%endif
%if 0%{?rhel_version} && 0%{?rhel_version} < 600
%undefine doAppWizard
%endif
%endif
%if 0%{?suse_version}
# SLES12 seems to have suse_version 1315, so does Leap
%if 0%{?suse_version} == 1315 || 0%{?suse_version} < 1210
%if 0%{?is_opensuse} == 0
%undefine doAppWizard
%endif
%endif
%endif
%{echo:"app wizard is (%{?doAppWizard})"}
Name: gpc
Version: %{GPC_VERSION}
Release: 25
Summary: Free 32/64-bit Pascal compiler of the GNU Compiler Collection
License: GPL-3.0+
Group: Development/Languages/Other
URL: http://www.gnu-pascal.de
Source0: http://www.math.uni.wroc.pl/~hebisch/gpc/%{name}-%{GPC_VERSION}.tar.bz2
Source1: gcc-core-%{GCC_VERSION}.tar.gz
Source2: http://www.gnu-pascal.de/contrib/maurice/%{name}-%{GPC_VERSION}.pdf
# extra stuff just for this package
Source3: gpc-extra.tar.bz2
# GnuPascal app wizard for kdevelop4
Source4: GnuPascal.tar.bz2
Source99: %name-rpmlintrc
# PATCH-FIX-UPSTREAM
Patch0: gpc-fix1.patch
# PATCH-FIX-UPSTREAM
Patch1: gpc-fix2.patch
# PATCH-FEATURE-OPENSUSE use native regular expressions
Patch2: gpc-regex.patch
# PATCH-FEATURE-OPENSUSE use native ncurses
Patch3: gpc-crt.patch
# PATCH-FEATURE-OPENSUSE remove user prompt in configure script
Patch4: gpc-fix3.patch
# PATCH-FIX-UPSTREAM - old fsf address in sources
Patch5: gpc-fix_fsf.patch
# PATCH-FIX-UPSTREAM
Patch6: gpc-fix_return.patch
# PATCH-FIX-OPENSUSE remove extra /doc that gpc adds to path for docs
Patch7: gpc-fix_docpath.patch
# PATCH-FIX-OPENSUSE reorder build so correct libs are used when using native compiler
Patch8: gpc-fix4.patch
# PATCH-FIX-UPSTREAM fix for string literal as const var parameter compiler error
Patch9: gpc-fix6.patch
# PATCH-FIX-UPSTREAM fix for failing i386 build
Patch10: gpc-fix_i386.patch
# PATCH-FIX-UPSTREAM fix for makeinfo version
Patch11: gpc-fix_makeinfo.patch
# PATCH-FIX-UPSTREAM fix for failing i386 build - github.com/JillTyrell/sabotage/commit/e0c93a4d5c36df41049451905d0c36948367e34c
Patch12: gcc-346-ucontext.patch
# PATCH-FIX-UPSTREAM fix error: fix warnings are now errors (gcc > 14ish)
Patch13: gpc_fix_warning_errors.patch
BuildRequires: glibc-devel,gmp-devel,ncurses-devel,flex,bison,binutils
%if 0%{!?rhel_version}
BuildRequires: help2man
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
GPC is a free 32/64-bit Pascal compiler of the GNU Compiler Collection
(GNU CC or GCC).
The compiler supports the following language standards:
- Standard Pascal (ISO 7185, levels 0 and 1)
- most of ISO 10206 Extended Pascal,
- Borland Pascal 7.0,
- parts of Borland Delphi, Mac Pascal, VAX Pascal, Sun Pascal
and Pascal extensions for scientific computing (PXSC).
It provides a lot of useful GNU extensions not found in other Pascal
compilers, e.g. to ease the interfacing with C and other languages in
a portable way, and to work with files, directories, dates and more,
mostly independent of the underlying operating system.
Included units provide support for regular expressions, arithmetic
with integer, rational and real numbers of unlimited size,
internationalization, inter-process communication, message digests
and more.
%package doc
Group: Documentation/Other
Summary: Gnu Pascal documentation
# some versions of rpm get very confused by this
#BuildArch: noarch
Requires(post): info
Requires(preun): info
%description doc
Gnu Pascal documentation, extensive program examples,
and detailed manual
%if 0%{?doAppWizard} != 0
%package kdevelopAppWizard
Version: 1
Summary: Gnu Pascal app wizard for kdevelop4
Group: System/GUI/KDE
#BuildArch: noarch
Requires: %{name},kdevelop4
%if 0%{?suse_version} > 1010 && 0%{?is_opensuse}
%if 0%{?sle_version} >= 150200 || 0%{?suse_version} > 1500
#BuildRequires: kde-filesystem
%else
BuildRequires: kde4-filesystem
%endif
%endif
%if 0%{?centos_version} > 505
BuildRequires: kde-filesystem
%endif
%if 0%{?rhel_version} > 505
BuildRequires: kde-filesystem
%endif
%if 0%{?scientificlinux_version} >= 600
BuildRequires: kde-filesystem
%endif
%if 0%{?fedora_version} >= 23
BuildRequires: kde-filesystem
%endif
%description kdevelopAppWizard
Gnu Pascal app wizard for kdevelop4
This package provides a template for kdevelop to start the development
of a pascal konsole application.
%else
%{echo:"omitting kdevelop4 app wizard for %{?_vendor}"}
%endif
%prep
echo xxxxxxxxxxxxxxxxxxx
echo suse_version is 0%{?suse_version}
echo sles_veersion is 0%{?sles_version}
%dump
echo xxxxxxxxxxxxxxxxxxx
# get pascal, apply patches
%setup -q
%setup -q -D -T -a 3
%patch -P0 -p0
%patch -P1 -p0
%patch -P2 -p0
%patch -P3 -p0
%patch -P4 -p0
%patch -P5 -p0
%patch -P6 -p0
%patch -P7 -p0
%patch -P9 -p0
%if !0%{?opensuse_bs}
# make source for gpc-test
tar jcf %{SOURCE2} p/test/
%endif
# add the pdf doc
%__cp %{SOURCE2} p/doc
# get gcc
%setup -q -D -T -a 1
%patch -P8 -p0
%patch -P10 -p0
%patch -P11 -p0
%patch -P12 -p0
%patch -P13 -p0
# get the app wizard
%setup -q -D -T -a 4
%build
%define gpc_docdir %{_docdir}
%define gpc_libdir %{_libdir}
%define gpc_execprefix %{_exec_prefix}
# correct documents dir in README files
pushd templates
for f in * ; do
mv $f t.$f
awk -v doc_dir="%{gpc_docdir}/" \
'{ gsub( /\/usr[^ ]*\/doc\//, doc_dir) ; print }' \
t.$f > $f
rm t.$f
done
tar vjcf ../GnuPascal.tar.bz2 *
cd ../p/doc
mv README.gpc.openSuSE t.README.gpc.openSuSE
awk -v doc_dir="%{gpc_docdir}/" \
'{ gsub( /\/usr[^ ]*\/doc\//, doc_dir) ; print }' \
t.README.gpc.openSuSE > README.gpc.%{_vendor}
rm t.README.gpc.openSuSE
popd
cd gcc-%{GCC_VERSION}
%{__mv} ../p ./gcc
# --exec-prefix : gcc tools, collect2 & gpc1 .../lib/gcc/...
# --libdir : where libs, units & gcc specific stuff goes
# --bindir : executable binaries go here
# --prefix : where everything else goes (ie the docs)
./configure --host=%{_host} --build=%{_build} \
--enable-languages=pascal \
--disable-mapped-location --enable-threads=posix --disable-nls \
--disable-multilib \
--disable-static \
--prefix=%{gpc_docdir} \
--exec-prefix=%{gpc_execprefix} \
--libexecdir=%{_libexecdir} \
--libdir=%{gpc_libdir} \
--bindir=%{_bindir} \
--mandir=%{_mandir} --infodir=%{_infodir}
%__make CFLAGS="-O2 -fmessage-length=0 \
%ifarch armv7hl
-mfloat-abi=hard \
%endif
-funwind-tables -fasynchronous-unwind-tables" LDFLAGS=-s -lm
%install
############ install gpc #############
pushd gcc-%{GCC_VERSION}/gcc
%__make DESTDIR=%{?buildroot:%{buildroot}} pascal.install-with-gcc
# if you prefer to use the lib that gpc made
# remove this & change gpc_libdir to keep these libs out of the way
%if 1
rm %{?buildroot:%{buildroot}}%{gpc_libdir}/../%{_lib}/libgcc_s.so.1
rm %{?buildroot:%{buildroot}}%{gpc_libdir}/../%{_lib}/libgcc_s.so
%if 0%{?mandriva_release} == 0
%__ln_s -v /%{_lib}/libgcc_s.so.1 \
%{?buildroot:%{buildroot}}%{gpc_libdir}/../%{_lib}/libgcc_s.so
%endif
%endif
# now the extra stuff ...
cd p/doc
%{__install} -m 644 \
README.gpc.%{_vendor} \
%{name}-%{GPC_VERSION}.pdf %{?buildroot:%{buildroot}}%{gpc_docdir}/%{name}
popd
%if 0%{?doAppWizard}
%if 0%{?_kde4_appsdir:1}
%define wizdir %{_kde4_appsdir}/kdevappwizard
%else
%if 0%{?_kde_appsdir:1}
%define wizdir %{_kde_appsdir}/kdevappwizard
%else
%define wizdir %(rpm -ql kapptemplate | grep -e kdevappwizard$)
%endif
%endif
############# install kdevelop app wizard #############
%__mkdir_p %{?buildroot:%{buildroot}}/%{wizdir}/template_previews/
%{__install} -m 644 \
gcc-%{GCC_VERSION}/gcc/p/doc/images/GnuPascal-small.png \
%{?buildroot:%{buildroot}}/%{wizdir}/template_previews/GnuPascal.png
%__mkdir_p %{?buildroot:%{buildroot}}/%{wizdir}/templates/
%{__install} -m 644 \
GnuPascal.tar.bz2 \
%{?buildroot:%{buildroot}}/%{wizdir}/templates
%endif
%post doc
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
#%info_add %{name}.info
%preun doc
if [ $1 = 0 ] ; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi
#%info_del %{name}.info
%clean
%{?buildroot:%__rm -rf "%{buildroot}"}
%files
%defattr(-,root,root)
%dir %{gpc_docdir}/%{name}
%{_bindir}/*
%{_mandir}/man1/*
%dir %{gpc_libdir}/gcc/%{_host}
%dir %{gpc_libdir}/gcc/%{_host}/%{GCC_VERSION}
%{gpc_libdir}/gcc/%{_host}/%{GCC_VERSION}/*
%if 0%{?mandriva_release} == 0
%{gpc_libdir}/../%{_lib}/libgcc_s.so
%endif
%if "%{gpc_libdir}" != "%{_libexecdir}"
%dir %{_libexecdir}/gcc
%dir %{_libexecdir}/gcc/%{_host}
%{_libexecdir}/gcc/%{_host}/%{GCC_VERSION}
%endif
%doc %{gpc_docdir}/%{name}/AUTHORS
%doc %{gpc_docdir}/%{name}/BUGS
%doc %{gpc_docdir}/%{name}/COPYING
%doc %{gpc_docdir}/%{name}/COPYING.LIB
%doc %{gpc_docdir}/%{name}/FAQ
%doc %{gpc_docdir}/%{name}/NEWS
%doc %{gpc_docdir}/%{name}/README
%doc %{gpc_docdir}/%{name}/README.gpc.%{_vendor}
# this doesn't work for mandriva
%if 0%{?mandriva_release} == 0
# don't need this in an already installed package
%exclude %{gpc_libdir}/gcc/%{_host}/%{GCC_VERSION}/install-tools/
%if "%{gpc_libdir}" != "%{_libexecdir}"
%exclude %{_libexecdir}/gcc/%{_host}/%{GCC_VERSION}/install-tools/
%endif
%endif
# remove spurious dir
%exclude %{gpc_docdir}/include
%files doc
%defattr(-,root,root)
%dir %{gpc_docdir}/%{name}
%dir %{gpc_docdir}/%{name}/demos
%dir %{gpc_docdir}/%{name}/docdemos
%{_infodir}/*
%{gpc_docdir}/%{name}/demos/*.*
%{gpc_docdir}/%{name}/docdemos/*.*
%doc %{gpc_docdir}/%{name}/COPYING.DEMO
%doc %{gpc_docdir}/%{name}/demos/README
%doc %{gpc_docdir}/%{name}/docdemos/README
%doc %{gpc_docdir}/%{name}/gpc-20070904.pdf
%if 0%{?mandriva_release} != 0
%{gpc_docdir}/%{name}/INSTALL
%else
%exclude %{gpc_docdir}/%{name}/INSTALL
%endif
%if 0%{?doAppWizard} != 0
%files kdevelopAppWizard
%defattr(-,root,root)
%dir %{wizdir}
%{wizdir}/templates
%{wizdir}/template_previews/GnuPascal.png
%{wizdir}/template_previews/
%{wizdir}/templates/GnuPascal.tar.bz2
%endif
%changelog
* Wed Apr 2 2025 trevorbl@localhost
- fix latest gcc is much stricter with warnings as errors
* Thu Jul 2 2020 trevorbl@localhost
- add support for latest distro versions, including Leap 15.2
* Tue Jun 28 2016 trevorbl@localhost
- add support for latest distro versions, including Leap
* Tue Oct 28 2014 trevorbl@localhost
- add support for SLES 12
* Tue Aug 20 2013 trevorbl@localhost
- add fix so only makeinfo version 4.x is compatible
* Wed Apr 10 2013 trevorbl@localhost
- add fix for i386 compile error
* Sun Nov 4 2012 trevorbl@localhost
- add fix for string literal as const var parameter compile error
* Fri Feb 3 2012 trevorbl@localhost
- create initial version
############################# end of gpc.spec #######################