-#!/usr/bin/perl\r
-\r
-my $version ;\r
-\r
-my $svnRelPath ;\r
-getRelPath() ;\r
-print "Relative path: $svnRelPath\n" ;\r
-my $upToRoot ;\r
-if ( $svnRelPath =~ /trunk/ ) {\r
- $upToRoot = '..' ;\r
-}\r
-else {\r
- $upToRoot = '..\\..' ;\r
-}\r
-# my $upToRoot = $svnRelPath ;\r
-# $upToRoot =~ s/([^\/]+)/../g ;\r
-# $upToRoot = "../$upToRoot" ;\r
-print "upToRoot: $upToRoot\n" ;\r
-\r
-getVersion() ;\r
-print "Version $version\n" ;\r
-\r
-my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);\r
-$year += 1900 ;\r
-\r
-my $distrPath = "cds-distrib/cds-$version" ;\r
-my $relDistrPath = "$upToRoot/$distrPath" ;\r
-\r
-print "export SVN...\n" ;\r
-exportSVN() ;\r
-\r
-my $nTabsFound = 0 ;\r
-\r
-print "make copyright...\n" ;\r
-makeCopyright() ;\r
-patchFile("$relDistrPath/build/Makefile", 'VERSION=\d+\.\d+\.\d+', "VERSION=$version" ) ;\r
-patchFile("$relDistrPath/doxygen/cds.doxy", 'PROJECT_NUMBER\s*=\s*\d+\.\d+\.\d+', "PROJECT_NUMBER = $version" ) ;\r
-patchFile("$relDistrPath/projects/Win/vc2008/cds.2008.vcproj", 'CDS_USE_VLD', 'xCDS_USE_VLD' ) ;\r
-patchFile("$relDistrPath/projects/Win/vc2008/unit.2008.vcproj", 'CDS_USE_VLD', 'xCDS_USE_VLD' ) ;\r
-patchFile("$relDistrPath/projects/android/jni/Android.mk", 'CDS_LIBRARY_VERSION\s*:=\s*\d+\.\d+\.\d+', \r
- "CDS_LIBRARY_VERSION := $version" );\r
-\r
-print "Tabs found: $nTabsFound\n" ;\r
-\r
-print "make docs...\n" ;\r
-`cd $relDistrPath && make_docs.bat` ;\r
-`rm -f $relDistrPath/make_distrib.pl` ;\r
-`rm -fr $relDistrPath/scripts` ;\r
-`rm -f $relDistrPath/doxygen/doxygen.log` ;\r
-\r
-print "make zip...\n" ;\r
-`rm -f $relDistrPath/../cds-$version.zip` ;\r
-`cd $relDistrPath/.. && 7za a cds-$version.zip cds-$version` ;\r
-\r
-print "Done\n" ;\r
-\r
-exit ;\r
-\r
-sub getVersion()\r
-{\r
- open( my $fh, 'cds/version.h' ) or die "ERROR: Cannot find cds/version.h file";\r
- binmode $fh ;\r
- \r
- while (<$fh>) {\r
- if ( /CDS_VERSION_STRING.+(\d+\.\d+\.\d+)/ ) {\r
- $version = $1 ;\r
- last ;\r
- }\r
- }\r
- close $fh ;\r
- die "ERROR: cannot find version in cds/version.h" unless $version ;\r
-}\r
-\r
-sub getRelPath()\r
-{\r
- my $svn = `svn info` ;\r
- ($svnRelPath) = $svn =~ /Working\sCopy\sRoot\sPath:\s+(.+)/ ;\r
-\r
- # my ($curDir) = $svn =~ /URL:\s+(.+)/ ;\r
- # my ($rootDir) = $svn =~ /Repository\s+Root:\s+(.+)/ ;\r
- # $rootDir =~ s/\+/\\\+/g ;\r
- \r
- # ($svnRelPath) = $curDir =~ /$rootDir\/(.+)/ ;\r
-}\r
-\r
-sub exportSVN()\r
-{\r
- `cd $upToRoot && rm -fr $distrPath && svn export $svnRelPath $distrPath` ;\r
-}\r
-\r
-sub makeCopyright() \r
-{\r
- processDir( "$relDistrPath/cds" ) ;\r
- processDir( "$relDistrPath/src" ) ;\r
- processDir( "$relDistrPath/tests/test-hdr" ) ;\r
- processDir( "$relDistrPath/tests/unit" ) ;\r
- processDir( "$relDistrPath/tests/cppunit" ) ;\r
-}\r
-\r
-sub processDir( $ )\r
-{\r
- my $dirName = shift ;\r
- \r
- opendir(my $dh, $dirName) || die "can't opendir $dirName: $!";\r
- my @files = grep { /^[^\.]/ } readdir($dh);\r
- closedir $dh;\r
- \r
- foreach my $file ( @files ) {\r
- if ( -d "$dirName/$file" ) {\r
- processDir("$dirName/$file") ;\r
- }\r
- elsif ( $file =~ /\.(h|cpp)$/ ) {\r
- processFile( "$dirName/$file" ) ;\r
- }\r
- }\r
-}\r
-\r
-sub processFile( $ ) \r
-{\r
- my $file = shift ;\r
-\r
- \r
- if ( open( my $fh, $file )) {\r
- binmode $fh ;\r
- my $str = '' ;\r
- while (<$fh>) {\r
- if ( /^\/\/\$\$CDS-header\$\$/ ) {\r
- $str .= \r
-"/*\r
- This file is a part of libcds - Concurrent Data Structures library\r
- See http://libcds.sourceforge.net/\r
-\r
- (C) Copyright Maxim Khiszinsky (libcds.sf\@gmail.com) 2006-$year\r
- Distributed under the BSD license (see accompanying file license.txt)\r
-\r
- Version $version\r
-*/\n\n" ;\r
- }\r
- elsif ( /^\/\/\$\$CDS-\/\*\$\$/ ) {\r
- $str .= "/*\n" ;\r
- }\r
- elsif ( /^\/\/\$\$CDS-\*\/\$\$/ ) {\r
- $str .= "*/\n" ;\r
- }\r
- else {\r
- $nTabsFound += $_ =~ s/\t/ /g;\r
- $_ =~ s/\s+$// ;\r
- $_ =~ s/\s+;$/;/;\r
- $str .= $_ ;\r
- $str .= "\n" ;\r
- }\r
- }\r
- close $fh ;\r
- \r
- if ( open( my $fh, ">$file" )) {\r
- binmode $fh ;\r
- print $fh $str ;\r
- close $fh ;\r
- }\r
- }\r
-}\r
-\r
-sub patchFile(@) {\r
- my $file = shift ;\r
- my $seek = shift ;\r
- my $repl = shift ;\r
- \r
- if ( open( my $fh, $file )) {\r
- binmode $fh ;\r
- \r
- my $str = '' ;\r
- $str .= $_ while <$fh> ;\r
- close $fh ;\r
- \r
- $str =~ s/$seek/$repl/g ;\r
- \r
- if ( open( my $fh, ">$file" )) {\r
- binmode $fh ;\r
- print $fh $str ;\r
- close $fh ;\r
- }\r
- }\r
-}\r
-\r
-\r
-\r
-\r