forked from fltk/fltk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makesrcdist
executable file
·184 lines (152 loc) · 5.02 KB
/
makesrcdist
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/sh
#
# makesrcdist - make a distribution of FLTK.
#
# There are 3 different modes of operation, dependent on commandline arguments:
#
# (1) Create snapshot:
#
# makesrcdist [snapshot]
#
# Use no arguments or "snapshot" (verbatim).
#
# (2) Create distribution tarballs for test and verification:
#
# makesrcdist <version>
#
# Use a version number as argument, e.g. "1.3.3" or "1.3.4rc2".
# This can be used for local testing.
#
# Note: the release tarballs will be created from the current
# 'HEAD' revision of your local Git repository.
#
# (3) Create distribution tarballs (final):
#
# makesrcdist <version> tag
#
# Same as (2), but create Git tag with version number.
# Enter "tag" (verbatim) as 2nd argument.
# This will create the Git tag "release-<version>" for the
# current revision in the (local) FLTK Git repository and export the
# FLTK sources from this tag for creation of distribution files.
#
# Note: You need to 'git push' the Git tag manually when you
# are satisfied with the result. You may use:
# $ git push origin release-<version>
# where '<version>' is the version number (argument #1)
#
# Note: define FLTK_TAR if you want to use a different compatible tar
# command than "tar", e.g. to use "gtar" (bash syntax):
# $ export FLTK_TAR="gtar"
#
TAR="tar"
if test "x$FLTK_TAR" != "x"; then
TAR="$FLTK_TAR"
fi
# These are the release and snapshot download URL's currently in use:
DOWNLOAD='https://www.fltk.org/pub/fltk'
SNAPSHOT='https://www.fltk.org/pub/fltk/snapshots'
DATE="`date +'%Y%m%d'`"
# VS = short version number ('major.minor'), for instance '1.4'.
# Note: VS is used only for snapshot generation
# fltk_version = full version number w/o 'rcN' (from file fltk_version.dat)
fltk_version="`cat fltk_version.dat`"
VS="`echo $fltk_version | cut -f 1-2 -d '.'`"
echo "Getting distribution..."
if test $# = 0 -o "x$1" = "xsnapshot"; then
echo Getting snapshot revision...
rev="`git rev-parse --short=8 HEAD`"
version="${VS}-${rev}"
fileversion="${VS}.x-${DATE}-$rev"
fileurl="$SNAPSHOT/fltk-$fileversion.tar.gz"
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
rev="1"
version=$1
fileversion=$1
fileurl="$DOWNLOAD/$version/fltk-$fileversion-source.tar.gz"
if test "x$2" = "xtag"; then
echo "Creating Git tag 'release-$version' ..."
git tag -a -m "Release $version" release-$version || exit 1
fi
fi
# Debug:
# echo "fltk_version = $fltk_version"
# echo "version = $version"
# echo "fileversion = $fileversion"
# echo "fileurl = $fileurl"
echo Exporting $fltk_version to /tmp/fltk-$version/...
rm -rf /tmp/fltk-$version
mkdir /tmp/fltk-$version
git archive --format=tar HEAD | $TAR -C /tmp/fltk-$version -x --
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
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 Cleaning developer files...
rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
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 (.tar.gz) distribution..."
$TAR czf fltk-$fileversion-source.tar.gz fltk-$version
echo "Making UNIX (.tar.bz2) distribution..."
$TAR cjf fltk-$fileversion-source.tar.bz2 fltk-$version
# echo "Making Windows (.zip) distribution..."
# rm -f fltk-$fileversion-source.zip
# zip -r9 fltk-$fileversion-source.zip fltk-$version
echo "Removing distribution directory..."
rm -rf fltk-$version
# Create MD5 sums
out="`pwd`/fltk-$fileversion-md5sums.txt"
echo "Creating MD5 sums in $out"
rm -f $out
touch $out
# make sure the order is source - html - pdf
for f in source docs-html docs-pdf; do
if [ -f fltk-$fileversion-$f.tar.bz2 ] ; then
md5sum fltk-$fileversion-$f.tar.bz2 >> $out
fi
if [ -f fltk-$fileversion-$f.tar.gz ] ; then
md5sum fltk-$fileversion-$f.tar.gz >> $out
fi
done
sed -e"s# # $fltk_version fltk/$fltk_version/#" -i $out
if test "x$2" = "xtag"; then
echo ""
echo "Don't forget to push the Git tag"
echo "(assuming your remote Git repository is 'origin'):"
echo ""
echo "Use: \$ git push origin release-$version"
echo ""
fi
echo "Done!"