added helper targets to the makefile. They shouldn't break anything, but
authorkick_ <kick_@users.sourceforge.net>
Fri, 12 Jul 2002 10:04:32 +0000 (10:04 +0000)
committerkick_ <kick_@users.sourceforge.net>
Fri, 12 Jul 2002 10:04:32 +0000 (10:04 +0000)
make my life a lot easier.

The new rpm has been splitted into two parts, one for package installation/
removal, one for package building.
Therefore rpm -ta isn't a valid command anymore and needs to be replaced
by rpmbuild -ta  (this is backwards compatible)

GNUmakefile.in

index 33e388c..b40872c 100644 (file)
@@ -1,6 +1,6 @@
 # Note:  Makefile is built automatically from Makefile.in
 #
-# $Id: GNUmakefile.in,v 1.104.2.6 2002/06/02 03:26:25 hal9 Exp $
+# $Id: GNUmakefile.in,v 1.104.2.7 2002/06/07 00:23:47 hal9 Exp $
 #
 # Written by and Copyright (C) 2001 the SourceForge
 # Privoxy team. http://www.privoxy.org/
@@ -43,6 +43,8 @@ VERSION_POINT = @VERSION_POINT@
 CODE_STATUS   = @CODE_STATUS@
 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
 RPM_VERSION   = $(VERSION)
+RPM_PACKAGEV  = $(RPM_VERSION)
+SNAPVERSION   = $(RPM_PACKAGEV)-$(shell date "+%Y%m%d")
 
 
 #############################################################################
@@ -74,6 +76,7 @@ STRIP_PROG = strip
 SED       = sed
 CAT        = cat
 RPM        = rpm
+RPMBUILD   = rpmbuild
 MV        = mv
 TAR        = tar
 LN         = ln
@@ -102,6 +105,8 @@ GROUP          = @GROUP@
 #DOSFILTER  = $(SED) -e $$'s,$$,\r,'
 #DOSFILTER  = gawk -v ORS='\r\n' '{print $0;}'
 DOSFILTER  = $(PERL) -p -e 's/\n/\r\n/'
+CVSROOT    = :pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa
+TMPDIR     := $(shell mktemp -d /tmp/$(PROGRAM).XXXXXX)
 
 #############################################################################
 # Setup for make distribution rh and suse for now 
@@ -269,6 +274,63 @@ dist-check:
          fi;
 
 
+#############################################################################
+# create tar.gz from CVS:
+# This make-target is usually called through 'create-archive'. If you 
+# run 'make create-snapshot' without setting SNAPVERSION, you'll get a
+# tar.gz with the current date in the name and as a releasenumber in the 
+# spec-file. But the main usage is to run it as follows (Red Hat example):
+# make SNAPVERSION=1.6x create-snapshot
+# This creates a tar.gz and spec-file for a Red Hat 6.x version.
+#############################################################################
+create-snapshot:
+       @tag=`cvs status Makefile | awk ' /Sticky Tag/ { print $$3 } '` 2> /dev/null; \
+       [ x"$$tag" = x"(none)" ] && tag=HEAD; \
+       echo "*** Creating package from $$tag!"; \
+       cd $(TMPDIR) ; cvs -Q -d $(CVSROOT) export -r $$tag current || echo "Um... export aborted."
+       @$(MV) $(TMPDIR)/current $(TMPDIR)/$(PROGRAM)-$(VERSION); \
+       cd $(TMPDIR)/$(PROGRAM)-$(VERSION); \
+       TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
+       if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
+               -e 's/^\(Release:\).*/\1 $(SNAPVERSION)/g' \
+               privoxy-rh.spec > $$TMPFILE ; then \
+                       $(MV) -f $$TMPFILE privoxy-rh.spec; \
+       else \
+               $(ECHO) "Could not set version info in specfile."; \
+       exit 1;\
+       fi;\
+       if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
+             -e 's/^\(Release:\).*/\1 $(SNAPVERSION)/g' \
+              privoxy-suse.spec > $$TMPFILE ; then \
+       $(MV) -f $$TMPFILE privoxy-suse.spec; \
+       else \
+               $(ECHO) "Could not set version info in specfile."; \
+       exit 1;\
+       fi; \
+       $(RM) $(TMPFILE)
+       @cd $(TMPDIR); \
+       $(TAR) --exclude ".cvsignore" --exclude "CVS" --exclude \
+               "privoxy-suse.spec" -czf $(PROGRAM)-rh-$(VERSION).tar.gz \
+               $(PROGRAM)-$(VERSION); \
+       $(TAR) --exclude ".cvsignore" --exclude "CVS" --exclude \
+               "privoxy-rh.spec" -czf $(PROGRAM)-suse-$(VERSION).tar.gz \
+               $(PROGRAM)-$(VERSION);
+       @$(MV) -f $(TMPDIR)/$(PROGRAM)-rh-$(VERSION).tar.gz .
+       @$(MV) -f $(TMPDIR)/$(PROGRAM)-suse-$(VERSION).tar.gz .
+       @$(RM) -rf $(TMPDIR)
+       @echo "Resulting files are $(PROGRAM)-rh-$(VERSION).tar.gz and"
+       @echo "                    $(PROGRAM)-suse-$(VERSION).tar.gz"
+
+
+#############################################################################
+# looks at the version of Makefile and exports a corresponding source-tree
+# example: if the Makefile has the sticky tag v_2_9_13, you'll get 
+# privoxy-*-2.4.13.tar.gz. Two different tar files will be written, one for
+# Red Hat and one for SuSe (different spec-files)
+#############################################################################
+create-archive:
+       make SNAPVERSION=$(SNAPVERSION) create-snapshot
+
 #############################################################################
 # RPM specifice stuff (SuSE or Redhat, ..)
 #############################################################################
@@ -318,7 +380,7 @@ conectiva-spec:
 conectiva-dist: rpm-stuff conectiva-spec
 
        $(TAR) --exclude ".cvsignore" --exclude "CVS" --exclude "privoxy-suse.spec" --exclude "privoxy-rh.spec" --exclude "PACKAGERS" -czf $(TAR_ARCH) .
-       $(RPM) --clean -ta  $(TAR_ARCH)
+       $(RPMBUILD) --clean -ta  $(TAR_ARCH)
        if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
 
 conectiva-upload: check-release
@@ -330,7 +392,7 @@ conectiva-upload: check-release
 redhat-dist: rpm-stuff
 
        $(TAR) --exclude ".cvsignore" --exclude "CVS" --exclude "privoxy-suse.spec" --exclude "privoxy-cl.spec" --exclude "PACKAGERS" -czf $(TAR_ARCH) .
-       $(RPM) --clean -ta  $(TAR_ARCH)
+       $(RPMBUILD) --clean -ta  $(TAR_ARCH)
        if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
 
 # anonymously ncftps the rpms to sourceforge
@@ -345,6 +407,16 @@ redhat-upload: check-release
        @$(ECHO) -------------------------------------------------------
      # w3m http://sourceforge.net/project/admin/editpackages.php?group_id=11118
 
+
+#############################################################################
+# Creates a Red Hat sourcepackage from CVS (not from the current sources
+# on disk)
+#############################################################################
+redhat-srpm: 
+       make create-archive
+       $(MV) $(PROGRAM)-rh-$(VERSION).tar.gz $(PROGRAM)-$(VERSION).tar.gz
+       $(RPMBUILD) -ts --nodeps $(PROGRAM)-$(VERSION).tar.gz
+
 #############################################################################
 # suse distribution. works fine. no need to be root. 
 #############################################################################
@@ -360,7 +432,7 @@ suse-dist: rpm-stuff
 #      fi
 
        $(TAR) --exclude ".cvsignore" --exclude "CVS" --exclude "privoxy-rh.spec" --exclude "privoxy-cl.spec" --exclude "PACKAGERS" -czf $(TAR_ARCH) .
-       $(RPM) --clean -ta  $(TAR_ARCH)
+       $(RPMBUILD) --clean -ta  $(TAR_ARCH)
        if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
 
 # anonymously ncftps the rpms to sourceforge
@@ -898,6 +970,10 @@ coffee:
 ## end:
 
 # $Log: GNUmakefile.in,v $
+# Revision 1.104.2.7  2002/06/07 00:23:47  hal9
+# Fixing a quirk of man2html (on my system) that pulls punctuation into URLs,
+# thus breaking them completely.
+#
 # Revision 1.104.2.6  2002/06/02 03:26:25  hal9
 # Update CONFIG_FILES (ie update basic.action, etc), and also DOC_FILES (exclude
 # index.html and team/index.html)