From 896f3062910e0bdcfdafa2ad3687d9d15e44f143 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 27 Oct 2003 16:58:10 +0000 Subject: [PATCH] * rpm updates --- Makefile | 16 +++++++++++++++- Makefile.fpc | 18 +++++++++++++++++- install/fpc.spec | 38 +++++++++++++++----------------------- install/fpcdoc.spec | 21 +++++++++++++++++++++ install/smart_strip.sh | 18 ++++++++++++++++++ 5 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 install/fpcdoc.spec create mode 100644 install/smart_strip.sh diff --git a/Makefile b/Makefile index b2042b54ed..f023ce7b29 100644 --- a/Makefile +++ b/Makefile @@ -2223,7 +2223,14 @@ ifdef inUnix ifneq ($(wildcard $(CVSINSTALL)/fpc.spec),) .PHONY: rpmcopy rpm RPMFPCVERSION:=$(shell grep '^Version:' $(CVSINSTALL)/fpc.spec | awk '{ print $$2 }') +RPMBUILD=$(shell which rpmbuild) +ifeq ($(RPMBUILD),) +RPMBUILD=rpm +endif REDHATDIR=/usr/src/redhat +ifeq ($(wildcard REDHATDIR),) +REDHATDIR=/usr/src/rpm +endif RPMSOURCESDIR:=$(REDHATDIR)/SOURCES RPMSPECDIR:=$(REDHATDIR)/SPECS RPMSRCDIR:=$(RPMSOURCESDIR)/fpc @@ -2233,6 +2240,9 @@ rpmcopy: distclean install -d $(RPMSOURCESDIR) rm -rf $(RPMSRCDIR) cp $(CVSINSTALL)/fpc.spec $(RPMSPECDIR)/fpc-$(RPMFPCVERSION).spec +ifndef NODOCS + cat $(CVSINSTALL)/fpcdoc.spec >> $(RPMSPECDIR)/fpc-$(RPMFPCVERSION).spec +endif install -d $(RPMSRCDIR) $(COPYTREE) compiler $(RPMSRCDIR) $(COPYTREE) rtl $(RPMSRCDIR) @@ -2244,10 +2254,14 @@ rpmcopy: distclean $(COPYTREE) Makefile* $(RPMSRCDIR) $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR) $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR) + $(COPY) $(CVSINSTALL)/smart_strip.sh $(RPMSRCDIR) + chmod +x $(RPMSRCDIR)/smart_strip.sh +ifndef NODOCS $(COPYTREE) docs $(RPMSRCDIR) +endif find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(RPMFPCVERSION)-src.tar.gz rpm: checkfpcdir rpmcopy - cd $(RPMSPECDIR) ; rpm --nodeps -ba fpc-$(RPMFPCVERSION).spec + cd $(RPMSPECDIR) ; $(RPMBUILD) --nodeps -ba fpc-$(RPMFPCVERSION).spec endif # spec found endif diff --git a/Makefile.fpc b/Makefile.fpc index 722a991409..f9094f1b5a 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -591,7 +591,16 @@ ifneq ($(wildcard $(CVSINSTALL)/fpc.spec),) RPMFPCVERSION:=$(shell grep '^Version:' $(CVSINSTALL)/fpc.spec | awk '{ print $$2 }') +# Only the recent rpms have rpmbuild +RPMBUILD=$(shell which rpmbuild) +ifeq ($(RPMBUILD),) +RPMBUILD=rpm +endif REDHATDIR=/usr/src/redhat +# Debian has /usr/src/rpm +ifeq ($(wildcard REDHATDIR),) +REDHATDIR=/usr/src/rpm +endif RPMSOURCESDIR:=$(REDHATDIR)/SOURCES RPMSPECDIR:=$(REDHATDIR)/SPECS RPMSRCDIR:=$(RPMSOURCESDIR)/fpc @@ -602,6 +611,9 @@ rpmcopy: distclean # fpc.rpm rm -rf $(RPMSRCDIR) cp $(CVSINSTALL)/fpc.spec $(RPMSPECDIR)/fpc-$(RPMFPCVERSION).spec +ifndef NODOCS + cat $(CVSINSTALL)/fpcdoc.spec >> $(RPMSPECDIR)/fpc-$(RPMFPCVERSION).spec +endif install -d $(RPMSRCDIR) $(COPYTREE) compiler $(RPMSRCDIR) $(COPYTREE) rtl $(RPMSRCDIR) @@ -613,12 +625,16 @@ rpmcopy: distclean $(COPYTREE) Makefile* $(RPMSRCDIR) $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR) $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR) + $(COPY) $(CVSINSTALL)/smart_strip.sh $(RPMSRCDIR) + chmod +x $(RPMSRCDIR)/smart_strip.sh +ifndef NODOCS $(COPYTREE) docs $(RPMSRCDIR) +endif find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(RPMFPCVERSION)-src.tar.gz rpm: checkfpcdir rpmcopy - cd $(RPMSPECDIR) ; rpm --nodeps -ba fpc-$(RPMFPCVERSION).spec + cd $(RPMSPECDIR) ; $(RPMBUILD) --nodeps -ba fpc-$(RPMFPCVERSION).spec endif # spec found diff --git a/install/fpc.spec b/install/fpc.spec index be1f9f6c04..aa2206aab2 100644 --- a/install/fpc.spec +++ b/install/fpc.spec @@ -21,6 +21,10 @@ BuildRequires: fpc %define buildlibdir %{buildroot}%{_libdir} %define buildexampledir %{buildroot}%{exampledir} +# The normal redhat rpm scripts does not recognize properly, what files to strip +# Hook our own strip command +%define __strip %{buildroot}/smart_strip.sh + %description The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit @@ -47,7 +51,9 @@ NEWFPDOC=`pwd`/utils/fpdoc/fpdoc make fcl_smart FPC=${NEWPP} make packages_extra_smart FPC=${NEWPP} make utils_all FPC=${NEWPP} +if [ -z ${NODOCS} ]; then make -C docs pdf FPDOC=${NEWFPDOC} +fi %install if [ %{buildroot} != "/" ]; then @@ -67,11 +73,18 @@ INSTALLOPTS="FPC=${NEWPP} INSTALL_PREFIX=%{buildroot}/usr INSTALL_LIBDIR=%{build make doc_install ${INSTALLOPTS} make man_install ${INSTALLOPTS} INSTALL_PREFIX=%{buildmandir} +if [ -z ${NODOCS} ]; then make -C docs pdfinstall DOCINSTALLDIR=%{builddocdir} +fi # create link ln -sf %{fpcdir}/ppc386 %{buildroot}%{_bindir}/ppc386 + # Workaround: + # newer rpm versions do not allow garbage + # delete lexyacc + rm -rf %{buildroot}/usr/lib/fpc/lexyacc + %clean make compiler_clean @@ -86,8 +99,8 @@ if [ %{buildroot} != "/" ]; then fi %post -# Create config -%{fpcdir}/samplecfg %{fpcdir} +# Create a version independent config +%{fpcdir}/samplecfg %{_libdir}/fpc/\$version %files %defattr(-, root, root) @@ -98,24 +111,3 @@ fi %doc %{docdir}/faq* %doc %{exampledir}/* %{_mandir}/*/* - -############################################################################### -# fpc-docs.rpm -# - -%package docs -Group: Development/Languages -Summary: Free Pascal Compiler - Documentation -%description docs -The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit -Pascal Compiler. It comes with fully TP 7.0 compatible run-time library. -Some extensions are added to the language, like function overloading. Shared -libraries can be linked. Basic Delphi support is already implemented (classes, -exceptions,ansistrings,RTTI). This package contains commandline compiler and -utils. Provided units are the runtime library (RTL), free component library -(FCL), gtk,ncurses,zlib, mysql,postgres,ibase bindings. -This package contains the documentation in PDF format - -%files docs -%defattr(-, root, root) -%doc %{docdir}/*.pdf diff --git a/install/fpcdoc.spec b/install/fpcdoc.spec new file mode 100644 index 0000000000..406e3aff86 --- /dev/null +++ b/install/fpcdoc.spec @@ -0,0 +1,21 @@ +############################################################################### +# fpc-docs.rpm +# +# Note: This file will be attached to the fpc.spec + +%package docs +Group: Development/Languages +Summary: Free Pascal Compiler - Documentation +%description docs +The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit +Pascal Compiler. It comes with fully TP 7.0 compatible run-time library. +Some extensions are added to the language, like function overloading. Shared +libraries can be linked. Basic Delphi support is already implemented (classes, +exceptions,ansistrings,RTTI). This package contains commandline compiler and +utils. Provided units are the runtime library (RTL), free component library +(FCL), gtk,ncurses,zlib, mysql,postgres,ibase bindings. +This package contains the documentation in PDF format + +%files docs +%defattr(-, root, root) +%doc %{docdir}/*.pdf diff --git a/install/smart_strip.sh b/install/smart_strip.sh new file mode 100644 index 0000000000..33ca8b6e84 --- /dev/null +++ b/install/smart_strip.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Wrapper for the strip command +# +# The redhat rpm scripts try to strip files, that can't be stripped. +# This wrapper simply skips some files. + +set -e +#set -x + +Params=$@ +# The last parameter is the file +for p in $Params; do + File=$p +done +echo $File | grep -q '\bpalmos\b' || strip $Params + +# end. +