Browse Source

* rpm updates

peter 22 years ago
parent
commit
896f306291
5 changed files with 86 additions and 25 deletions
  1. 15 1
      Makefile
  2. 17 1
      Makefile.fpc
  3. 15 23
      install/fpc.spec
  4. 21 0
      install/fpcdoc.spec
  5. 18 0
      install/smart_strip.sh

+ 15 - 1
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

+ 17 - 1
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
 

+ 15 - 23
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

+ 21 - 0
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

+ 18 - 0
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.
+