Files
PolyORB/utils/prepare_distrib
bortolussi d6e9f0b9d5 Generate configure
Make `configure` available in the repo.

`utils/prepare_distrib -G .` can be used to generate `configure`
`utils/adapt_configure -R <release> -V <version<` can be used to set the
polyorb version.

eng/shared/anod#298
2024-03-22 17:41:54 +01:00

163 lines
3.7 KiB
Bash
Executable File

#!/bin/sh
#
# $Id$
#
# This script performs all the necessary steps to transform a checked
# out copy of PolyORB into a source tree suitable for packaging.
#
# The file MANIFEST contains the list of files to be included in this
# archive, one file per line.
#
change=
with_doc=false
###################################################
# Usage information
###################################################
usage() {
echo "Usage: $0 [-c CHANGE] [-R release] [-V version] [-D] dir"
echo " -c optional CM change identifier"
echo " -R override release identifier"
echo " -V optional additional version identifier"
echo " -D build documentation"
echo " -G generate generic configure"
exit 1
}
set -e
###################################################
# Parse commande line
###################################################
while getopts c:R:V:D:G opt; do
case "$opt" in
c) change="$OPTARG" ;;
D) with_doc=true ;;
R) override_release="$OPTARG" ;;
V) additional_version="$OPTARG" ;;
G) generic_configure=true ;;
*) usage ;;
esac
done
# Set default value
generic_configure=${generic_configure:=false}
if [ $generic_configure ]
then
additional_version=@ADDITIONAL_VERSION_PLACEHOLDER@
override_release=@OVERRIDE_RELEASE_PLACEHOLDER@
fi
shift `expr $OPTIND - 1`
if [ $# != 1 ]; then
usage
fi
dir=$1
cd $dir
rm -f MANIFEST.distrib
if [ ! -z "$change" ]; then
taginfo="CHANGE_${change}"
if [ ! -f "${taginfo}" ]; then
LANG=C date "+Packaged from repository rev. ${change} on %c" > ${taginfo}
fi
echo ${taginfo} >> MANIFEST.distrib
fi
###################################################
# Update version in all files
###################################################
# sed_in_place FILE ARG...
# Apply "sed ARG..." transformation to FILE
sed_in_place() {
oldfile=$1; shift
newfile=$oldfile.new.$$
sed "$@" < $oldfile > $newfile
mv -f $newfile $oldfile
}
#
# Generate configure script
#
# Generate distrib.m4 to pass additional information related to packaged
# sources to autoconf.
(
# Switch default warnings mode to "n" (default is "e" when building from
# a checkout).
echo "define([DEFAULT_WARNINGS_MODE], [n])"
# Strip binaries when installing in non-debug mode
echo "define([STRIP_PRODUCTION_BINARIES], [true])"
# Release name override and additional version information from command line
if [ -n "$override_release" ]; then
echo "define([OVERRIDE_RELEASE],[$override_release])"
fi
if [ -n "$additional_version" ]; then
echo "define([ADDITIONAL_VERSION],[$additional_version])"
fi
# Source configuration management revision information (optional)
if [ -n "$change" ]; then
echo "define([DISTRIB_CMREVISION],[${change}])"
fi
# Use MANIFEST to filter output files
echo "define([OUTPUT_FILTER],[MANIFEST])"
# Define longest file name (configure will check its presence)
longest_file_name=`awk 'BEGIN{max=""}{if (length($0) > length(max)) {max=$0}}END{print max}' < MANIFEST`
echo "define([LONGEST_FILE_NAME],[$longest_file_name])"
) > support/distrib.m4
echo support/distrib.m4 >> MANIFEST.distrib
echo Generating auto-generated files
sh support/reconfig -w
if [ ! $generic_configure ]
then
polyorb_version=`./configure --version | sed -n 's/^PolyORB configure //p'`
echo "Setting version: ${polyorb_version}"
for f in VERSION; do
sed_in_place $f "s/@polyorb_version@/${polyorb_version}/g"
done
fi
###################################################
# Build documentation (optional)
###################################################
if $with_doc; then
./configure && make docs
sed 's#^#doc/#' < doc/MANIFEST >> MANIFEST.distrib
fi
echo 'Updating MANIFEST'
cat MANIFEST.distrib >> MANIFEST
utils/sort_MANIFEST
echo "Adapting modes"
chmod -R og=u-w .