2001-08-18 23:42:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
2004-05-12 10:13:38 +00:00
|
|
|
# makesrcdist - make a distribution of FLTK.
|
2001-08-18 23:42:36 +00:00
|
|
|
#
|
2014-10-30 12:42:54 +00:00
|
|
|
# There are 3 different modes of operation, dependent on commandline arguments:
|
|
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# (1) Create snapshot:
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# ./makesrcdist [snapshot]
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# Use no arguments or "snapshot" (verbatim).
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# (2) Create distribution tarballs for test and verification:
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# ./makesrcdist <version> <doc-dir>
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# <version> : Use a version number as argument, e.g. "1.3.3" or "1.3.4rc2".
|
|
|
|
|
# This can be used for local testing.
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# <doc-dir> : This *MUST* be a CMake build folder where all the
|
|
|
|
|
# documentation (HTML, PDF, Fluid-HTML, and Fluid-PDF) were built.
|
|
|
|
|
# The directory name can be relative to the FLTK root or absolute.
|
2018-10-18 16:21:45 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# Note: the release tarballs will be created from the current
|
|
|
|
|
# 'HEAD' revision of your local Git repository. Make sure that
|
|
|
|
|
# you committed all changes.
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# (3) Create distribution tarballs (final):
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# ./makesrcdist <version> <doc-dir> tag
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
2024-12-09 17:37:04 +01:00
|
|
|
# Same as (2), but create Git tag with version number.
|
|
|
|
|
# Enter "tag" (verbatim) as 3rd 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 <origin> is your remote repository, e.g. "origin" or "upstream"
|
|
|
|
|
# and <version> is the version number (argument #1)
|
2018-10-18 16:21:45 +00:00
|
|
|
#
|
2014-10-30 12:42:54 +00:00
|
|
|
# Note: define FLTK_TAR if you want to use a different compatible tar
|
2024-12-09 17:37:04 +01:00
|
|
|
# command than "tar", e.g. to use "gtar" (bash syntax):
|
|
|
|
|
# $ export FLTK_TAR="gtar"
|
2014-10-30 12:42:54 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
TAR="tar"
|
|
|
|
|
if test "x$FLTK_TAR" != "x"; then
|
|
|
|
|
TAR="$FLTK_TAR"
|
|
|
|
|
fi
|
|
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
# Default version numbers from commandline, overwritten later for snapshots
|
|
|
|
|
version="$1"
|
|
|
|
|
fileversion="$1"
|
|
|
|
|
|
|
|
|
|
# Set DOC_DIR for full source distribution with documentation.
|
|
|
|
|
# This is not used for snapshots, see comments above.
|
|
|
|
|
|
|
|
|
|
DOC_DIR="$2"
|
2014-10-30 12:42:54 +00:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
# These are the release and snapshot download URL's currently in use.
|
|
|
|
|
# The 'DOWNLOAD' URL is on GitHub since FLTK 1.4.1,
|
|
|
|
|
# the 'SNAPSHOT' URL is on fltk.org.
|
|
|
|
|
|
|
|
|
|
DOWNLOAD="https://github.com/fltk/fltk/releases/download" # /release-$1/fltk-$1-source.tar.gz
|
2019-02-12 14:07:53 +01:00
|
|
|
SNAPSHOT='https://www.fltk.org/pub/fltk/snapshots'
|
2018-10-18 16:21:45 +00:00
|
|
|
|
|
|
|
|
DATE="`date +'%Y%m%d'`"
|
|
|
|
|
|
2024-08-12 19:58:32 +02:00
|
|
|
GIT_REVISION=$(git rev-parse HEAD)
|
2024-12-09 17:37:04 +01:00
|
|
|
git_rev=$(git rev-parse --short=12 HEAD)
|
2024-08-12 19:58:32 +02:00
|
|
|
|
2018-10-18 16:21:45 +00:00
|
|
|
# VS = short version number ('major.minor'), for instance '1.4'.
|
|
|
|
|
# Note: VS is used only for snapshot generation
|
2021-02-20 13:45:47 +01:00
|
|
|
# fltk_version = full version number w/o 'rcN' (from file fltk_version.dat)
|
2024-12-09 17:37:04 +01:00
|
|
|
# git_rev = short Git revision (12 chars)
|
2018-10-18 16:21:45 +00:00
|
|
|
|
2021-02-20 13:45:47 +01:00
|
|
|
fltk_version="`cat fltk_version.dat`"
|
|
|
|
|
VS="`echo $fltk_version | cut -f 1-2 -d '.'`"
|
2001-08-18 23:42:36 +00:00
|
|
|
|
|
|
|
|
echo "Getting distribution..."
|
|
|
|
|
|
2014-10-30 12:42:54 +00:00
|
|
|
if test $# = 0 -o "x$1" = "xsnapshot"; then
|
2024-12-09 17:37:04 +01:00
|
|
|
echo Getting snapshot revision...
|
|
|
|
|
version="${VS}-${git_rev}"
|
|
|
|
|
fileversion="${VS}.x-${DATE}-$git_rev"
|
|
|
|
|
fileurl="$SNAPSHOT/fltk-$fileversion.tar.gz"
|
2001-08-18 23:42:36 +00:00
|
|
|
else
|
2024-12-09 17:37:04 +01:00
|
|
|
# DOC_DIR must be specified
|
|
|
|
|
if test $# = 1 ; then
|
|
|
|
|
echo "ERROR: doc-dir (2nd argument) must be specified"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
# DOC_DIR must be a CMake build folder
|
|
|
|
|
if test ! -f $DOC_DIR/CMakeCache.txt ; then
|
|
|
|
|
echo "ERROR: doc-dir (2nd argument) must be a CMake build folder."
|
|
|
|
|
echo "Please generate all docs in this CMake build before distributing:"
|
|
|
|
|
echo " cd $DOC_DIR"
|
|
|
|
|
echo " make|ninja html pdf fluid_docs fluid_pdf"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
if test ! -e "$DOC_DIR/documentation/html/"; then
|
|
|
|
|
echo "ERROR: Please generate the HTML documentation before distributing:"
|
|
|
|
|
echo " cd $DOC_DIR"
|
|
|
|
|
echo " make|ninja html pdf fluid_docs fluid_pdf"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
if test ! -e "$DOC_DIR/documentation/fltk.pdf"; then
|
|
|
|
|
echo "ERROR: Please generate the PDF documentation before distributing:"
|
|
|
|
|
echo " cd $DOC_DIR"
|
|
|
|
|
echo " make|ninja pdf fluid_docs fluid_pdf"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
if test ! -e "$DOC_DIR/fluid/documentation/fluid.pdf"; then
|
|
|
|
|
echo "ERROR: Please generate the fluid documentation before distributing:"
|
|
|
|
|
echo " cd $DOC_DIR"
|
|
|
|
|
echo " ninja fluid_docs fluid_pdf"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
fileurl="$DOWNLOAD/release-$version/fltk-$fileversion-source.tar.gz"
|
|
|
|
|
|
|
|
|
|
if test "x$3" = "xtag"; then
|
|
|
|
|
echo "Creating Git tag 'release-$version' ..."
|
|
|
|
|
git tag -a -m "Release $version" release-$version || exit 1
|
|
|
|
|
fi
|
2001-08-19 00:09:06 +00:00
|
|
|
fi
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
# where to build the distribution tarballs and other files:
|
|
|
|
|
|
|
|
|
|
TEMP_DIR="/tmp/fltk-$version"
|
|
|
|
|
|
|
|
|
|
# subdirectory of $TEMP_DIR for documentation in their tarballs
|
|
|
|
|
#
|
|
|
|
|
# This resembles the directory structure of releases where documentation
|
|
|
|
|
# would likely be installed in "/usr/share/doc/fltk".
|
|
|
|
|
|
|
|
|
|
DOC_TEMPDIR="share/doc/fltk"
|
2019-02-12 14:07:53 +01:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
# Debug:
|
|
|
|
|
### echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
|
|
|
|
### echo "fltk_version = $fltk_version"
|
|
|
|
|
### echo "version = $version"
|
|
|
|
|
### echo "fileversion = $fileversion"
|
|
|
|
|
### echo "fileurl = $fileurl"
|
|
|
|
|
### echo "GIT_REVISION = $GIT_REVISION"
|
|
|
|
|
### echo "git_rev = $git_rev"
|
|
|
|
|
### echo "TEMP_DIR = $TEMP_DIR"
|
|
|
|
|
### echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
|
|
|
|
|
|
|
|
|
|
echo Exporting $fltk_version to $TEMP_DIR/...
|
2025-05-21 16:34:39 +02:00
|
|
|
rm -rf $TEMP_DIR
|
|
|
|
|
mkdir $TEMP_DIR
|
|
|
|
|
git archive --format=tar HEAD | $TAR -C $TEMP_DIR -x --
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2014-10-30 12:42:54 +00:00
|
|
|
if test $# != 0 -a "x$1" != "xsnapshot"; then
|
2024-12-09 17:37:04 +01:00
|
|
|
|
|
|
|
|
mkdir -p $TEMP_DIR/$DOC_TEMPDIR/fluid
|
|
|
|
|
|
|
|
|
|
echo "Copying HTML and PDF documentation..."
|
|
|
|
|
cp -r $DOC_DIR/documentation/html $TEMP_DIR/$DOC_TEMPDIR/
|
|
|
|
|
cp $DOC_DIR/documentation/fltk.pdf $TEMP_DIR/$DOC_TEMPDIR/
|
|
|
|
|
|
|
|
|
|
echo "Copying FLUID HTML and PDF documentation..."
|
|
|
|
|
cp -r $DOC_DIR/fluid/documentation/html $TEMP_DIR/$DOC_TEMPDIR/fluid/
|
|
|
|
|
cp $DOC_DIR/fluid/documentation/fluid.pdf $TEMP_DIR/$DOC_TEMPDIR/
|
2010-12-29 17:08:28 +00:00
|
|
|
fi
|
|
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
# Change directory to working directory
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
cd $TEMP_DIR
|
2024-08-12 19:58:32 +02:00
|
|
|
|
|
|
|
|
# Write git revision file with full git revision
|
|
|
|
|
# which will be stored in the distribution tarball
|
|
|
|
|
|
|
|
|
|
echo Writing git revision file...
|
|
|
|
|
echo "$GIT_REVISION" > fltk_git_rev.dat
|
|
|
|
|
|
2001-08-18 23:42:36 +00:00
|
|
|
cd ..
|
|
|
|
|
|
2014-10-30 12:42:54 +00:00
|
|
|
if test $# != 0 -a "x$1" != "xsnapshot"; then
|
2024-12-09 17:37:04 +01:00
|
|
|
echo "Making HTML docs distribution..."
|
|
|
|
|
$TAR czf fltk-$fileversion-docs-html.tar.gz fltk-$version/$DOC_TEMPDIR/html/
|
|
|
|
|
|
|
|
|
|
echo "Making PDF docs distribution..."
|
|
|
|
|
$TAR czf fltk-$fileversion-docs-pdf.tar.gz fltk-$version/$DOC_TEMPDIR/fltk.pdf
|
|
|
|
|
|
|
|
|
|
echo "Making Fluid HTML docs distribution..."
|
|
|
|
|
$TAR czf fltk-$fileversion-fluid-docs-html.tar.gz fltk-$version/$DOC_TEMPDIR/fluid/html/
|
|
|
|
|
|
|
|
|
|
echo "Making Fluid PDF docs distribution..."
|
|
|
|
|
$TAR czf fltk-$fileversion-fluid-docs-pdf.tar.gz fltk-$version/$DOC_TEMPDIR/fluid.pdf
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2010-12-29 17:08:28 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Removing documentation..."
|
2024-12-13 00:16:38 +01:00
|
|
|
rm -rf fltk-$version/$DOC_TEMPDIR
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2019-02-12 14:07:53 +01:00
|
|
|
echo "Making UNIX (.tar.gz) distribution..."
|
2014-10-30 12:42:54 +00:00
|
|
|
$TAR czf fltk-$fileversion-source.tar.gz fltk-$version
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2019-02-12 14:07:53 +01:00
|
|
|
echo "Making UNIX (.tar.bz2) distribution..."
|
|
|
|
|
$TAR cjf fltk-$fileversion-source.tar.bz2 fltk-$version
|
2001-08-18 23:42:36 +00:00
|
|
|
|
2019-02-12 14:07:53 +01:00
|
|
|
# echo "Making Windows (.zip) distribution..."
|
|
|
|
|
# rm -f fltk-$fileversion-source.zip
|
|
|
|
|
# zip -r9 fltk-$fileversion-source.zip fltk-$version
|
2001-08-18 23:42:36 +00:00
|
|
|
|
|
|
|
|
echo "Removing distribution directory..."
|
|
|
|
|
|
|
|
|
|
rm -rf fltk-$version
|
|
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
# Create releases.txt, md5sums.txt, and sha256sums.txt
|
2019-02-12 14:07:53 +01:00
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
OUTF="`pwd`/fltk-$fileversion-releases.txt"
|
|
|
|
|
MD5F="`pwd`/fltk-$fileversion-md5sums.txt"
|
|
|
|
|
SHAF="`pwd`/fltk-$fileversion-sha256sums.txt"
|
2019-02-12 14:07:53 +01:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "Creating Release Info in $OUTF and $SHAF"
|
2019-02-12 14:07:53 +01:00
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "" > $OUTF
|
|
|
|
|
echo "github $fltk_version $fileversion" >> $OUTF
|
|
|
|
|
echo "" >> $OUTF
|
|
|
|
|
rm -f $SHAF
|
|
|
|
|
touch $SHAF
|
2024-12-09 17:37:04 +01:00
|
|
|
|
|
|
|
|
# make sure the order is source, html, pdf, fluid-html, fluid-pdf and gz, bz2
|
|
|
|
|
|
|
|
|
|
for f in source docs-html docs-pdf fluid-docs-html fluid-docs-pdf; do
|
|
|
|
|
for t in gz bz2; do
|
|
|
|
|
FILE="fltk-$fileversion-$f.tar.$t"
|
|
|
|
|
if [ -f $FILE ] ; then
|
|
|
|
|
|
|
|
|
|
# (a) releases file:
|
|
|
|
|
MD5=`md5sum $FILE | cut -f1 -d' '`
|
|
|
|
|
SIZ=`wc -c $FILE | cut -f1 -d' '`
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "$MD5 $FILE $SIZ" >> $OUTF
|
2024-12-09 17:37:04 +01:00
|
|
|
|
2025-05-21 16:34:39 +02:00
|
|
|
# (b) md5sum file
|
|
|
|
|
md5sum $FILE >> $MD5F
|
|
|
|
|
|
|
|
|
|
# (c) sha256sum file
|
|
|
|
|
sha256sum $FILE >> $SHAF
|
2024-12-09 17:37:04 +01:00
|
|
|
fi
|
|
|
|
|
done
|
2019-02-12 14:07:53 +01:00
|
|
|
done
|
|
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
# finally add the sha256sum file (after it is complete) to the releases file
|
2019-02-12 14:07:53 +01:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
FILE="fltk-$fileversion-sha256sums.txt"
|
|
|
|
|
MD5=`md5sum $FILE | cut -f1 -d' '`
|
|
|
|
|
SIZ=`wc -c $FILE | cut -f1 -d' '`
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "$MD5 $FILE $SIZ" >> $OUTF
|
2018-10-18 16:21:45 +00:00
|
|
|
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
2003-05-26 16:23:08 +00:00
|
|
|
echo "Done!"
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
|
|
|
|
echo "================================================================================"
|
|
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "$OUTF:"
|
|
|
|
|
echo
|
|
|
|
|
echo "--- snip --- copy the contents of this file to the top of data/releases.dat:"
|
|
|
|
|
cat $OUTF
|
|
|
|
|
echo "--- snip --- end of file ---"
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "MD5 sums: $MD5F:"
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
cat $MD5F
|
2024-12-09 17:37:04 +01:00
|
|
|
|
|
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "SHA256 sums: $SHAF:"
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
cat $SHAF
|
2024-12-09 17:37:04 +01:00
|
|
|
|
|
|
|
|
if test "x$3" = "xtag"; then
|
|
|
|
|
echo
|
|
|
|
|
echo "================================================================================"
|
|
|
|
|
echo "Don't forget to push the Git tag if the result is OK"
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "(assuming your remote Git repository is 'upstream'):"
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
2025-05-21 16:34:39 +02:00
|
|
|
echo "Use: \$ git push upstream release-$version"
|
2024-12-09 17:37:04 +01:00
|
|
|
echo
|
|
|
|
|
echo "If test results are not OK you can delete the tag before pushing:"
|
|
|
|
|
echo
|
|
|
|
|
echo "$ git tag -d release-$version"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "================================================================================"
|
|
|
|
|
echo
|