summaryrefslogtreecommitdiff
path: root/makesrcdist
blob: 1a8ed06dba20da0123455d8c0baa9ead3dc89d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
#
# makesrcdist - make a distribution of FLTK.
#

TAR='tar'
SVN='http://seriss.com/public/fltk/fltk'
DOWNLOAD='http://fltk.org/pub/fltk'
SNAPSHOTS='http://fltk.org/pub/fltk/snapshots'

echo "Getting distribution..."

if test $# = 0 -o "x$1" = xsnapshot; then
	echo Updating for snapshot...
	svn up
	rev=`svnversion . | sed -e '1,$s/[a-zA-Z]//g'`
	version="1.3svn"
	fileversion="1.3.x-r$rev"
	fileurl="$SNAPSHOTS/fltk-$fileversion.tar.gz"
#	e.g. http://fltk.org/pub/fltk/snapshots/fltk-1.3.x-r10337.tar.gz
	url="."
else
	if test ! -e "documentation/html/"; then
		echo "ERROR: Please generate the HTML documentation before distributing:"
		echo "  autoconf"
		echo "  ./configure"
		echo "  cd documentation; make dist"
		exit
	fi
	if test ! -e "documentation/fltk.pdf"; then
		echo "ERROR: Please generate the PDF documentation before distributing:"
		echo "  autoconf"
		echo "  ./configure"
		echo "  cd documentation; make dist"
		exit
	fi
	echo Creating tag for release...
	rev="1"
	version=$1
	fileversion=$1
	fileurl="$DOWNLOAD/$version/fltk-$fileversion-source.tar.gz"
#	e.g. http://fltk.org/pub/fltk/1.3.2/fltk-1.3.2-source.tar.gz

	if test "x$2" = xtest; then
		url="."
	else
		url="$SVN/tags/release-$version"
		svn copy $SVN/branches/branch-1.3 "$url" \
		-m "Tag $version" || exit 1
	fi
fi

echo Exporting $version...
rm -rf /tmp/fltk-$version
svn export $url /tmp/fltk-$version

if test $# != 0 -a "x$1" != xsnapshot; then
	echo "Copying HTML and PDF documentation..."
	cp -r documentation/html /tmp/fltk-$version/documentation/
	cp documentation/fltk.pdf /tmp/fltk-$version/documentation/
fi

echo Applying version number...
cd /tmp/fltk-$version

fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
sed -e '1,$s/@VERSION@/'$version'/' \
	-e '1,$s/@RELEASE@/'$rev'/' \
	-e '1,$s/^Source:.*/Source: '$fileurl'/' \
	<fltk.spec.in >fltk.spec

echo Creating configure script...
autoconf -f

echo Creating config.guess and config.sub \(ignore any other errors\)...
automake --add-missing --copy

echo Cleaning developer files...
rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
rm -f makesrcdist

cd ..

if test $# != 0 -a "x$1" != xsnapshot; then
	echo "Making HTML docs distribution..."
	$TAR czf fltk-$fileversion-docs-html.tar.gz fltk-$version/documentation/html/

	echo "Making PDF docs distribution..."
	$TAR czf fltk-$fileversion-docs-pdf.tar.gz fltk-$version/documentation/fltk.pdf
fi

echo "Removing documentation..."
rm -rf fltk-$version/documentation/html/
rm -f fltk-$version/documentation/fltk.pdf

echo "Making UNIX distribution..."
$TAR czf fltk-$fileversion-source.tar.gz fltk-$version

#echo "Making BZ2 distribution..."
#$TAR cjf fltk-$fileversion-source.tar.bz2 fltk-$version

#echo "Making Windows distribution..."
#rm -f fltk-$fileversion-source.zip
#zip -r9 fltk-$fileversion-source.zip fltk-$version

echo "Removing distribution directory..."

rm -rf fltk-$version

echo "Done!"