2 # $Id: make-tar.sh,v 1.19 2022/02/05 17:57:45 tom Exp $
3 ##############################################################################
4 # Copyright 2019-2021,2022 Thomas E. Dickey #
5 # Copyright 2010-2015,2017 Free Software Foundation, Inc. #
7 # Permission is hereby granted, free of charge, to any person obtaining a #
8 # copy of this software and associated documentation files (the "Software"), #
9 # to deal in the Software without restriction, including without limitation #
10 # the rights to use, copy, modify, merge, publish, distribute, distribute #
11 # with modifications, sublicense, and/or sell copies of the Software, and to #
12 # permit persons to whom the Software is furnished to do so, subject to the #
13 # following conditions: #
15 # The above copyright notice and this permission notice shall be included in #
16 # all copies or substantial portions of the Software. #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
21 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
23 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
24 # DEALINGS IN THE SOFTWARE. #
26 # Except as contained in this notice, the name(s) of the above copyright #
27 # holders shall not be used in advertising or otherwise to promote the sale, #
28 # use or other dealings in this Software without prior written #
30 ##############################################################################
31 # Construct a tar-file containing only the test tree as well as its associated
32 # scripts. The reason for doing that is to simplify distributing the test
33 # programs as a separate package.
40 : "${PKG_NAME:=ncurses-examples}"
41 : "${ROOTNAME:=ncurses-test}"
42 : "${DESTDIR:=$TARGET}"
46 grep_assign=`grep -E "^$2\>" "$1" | sed -e "s/^$2[ ]*=[ ]*//" -e 's/"//g'`
47 eval "$2"=\""$grep_assign"\"
51 grep_assign ../dist.mk NCURSES_MAJOR
52 grep_assign ../dist.mk NCURSES_MINOR
53 grep_assign ../dist.mk NCURSES_PATCH
56 # The rpm spec-file in the ncurses tree is a template. Fill in the version
57 # information from dist.mk
60 -e "s/\\<MAJOR\\>/$NCURSES_MAJOR/g" \
61 -e "s/\\<MINOR\\>/$NCURSES_MINOR/g" \
62 -e "s/\\<YYYYMMDD\\>/$NCURSES_PATCH/g" "$1" >"$1.new"
68 [ -f "$1" ] && chmod u+w "$1"
70 `echo $PKG_NAME|tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` ($NCURSES_MAJOR.$NCURSES_MINOR+$NCURSES_PATCH) unstable; urgency=low
72 * snapshot of ncurses subpackage for $PKG_NAME.
74 -- `head -n 1 "$HOME"/.signature` `date -R`
78 # This can be run from either the subdirectory, or from the top-level
79 # source directory. We will put the tar file in the original directory.
86 BUILD=$TMPDIR/make-tar$$
87 trap "cd /; rm -rf $BUILD; exit 0" 1 2 3 15
88 trap "cd /; rm -rf $BUILD; exit 0" 0
93 echo "? cannot make build directory $BUILD"
97 mkdir $BUILD/$ROOTNAME
99 cp -p -r ./* $BUILD/$ROOTNAME/ || exit
101 # Add the config.* utility scripts from the top-level directory.
104 for j in COPYING config.guess config.sub install-sh tar-copy.sh
106 [ -f $i/$j ] && cp -p $i/$j $BUILD/$ROOTNAME/
110 # Make rpm and dpkg scripts for test-builds
112 for spec in "$BUILD/$ROOTNAME"/package/*.spec
114 edit_specfile "$spec"
116 for spec in "$BUILD/$ROOTNAME"/package/debian*
118 make_changelog "$spec"/changelog
121 cp -p "$SOURCE/NEWS" "$BUILD/$ROOTNAME"
123 # cleanup empty directories (an artifact of ncurses source archives)
125 touch $BUILD/$ROOTNAME/MANIFEST
126 ( cd $BUILD/$ROOTNAME && find . -type f -print | "$SOURCE/misc/csort" >MANIFEST )
130 # Remove build-artifacts.
131 find . -name RCS -exec rm -rf {} \;
132 find $BUILD/$ROOTNAME -type d -exec rmdir {} \; 2>/dev/null
133 find $BUILD/$ROOTNAME -type d -exec rmdir {} \; 2>/dev/null
134 find $BUILD/$ROOTNAME -type d -exec rmdir {} \; 2>/dev/null
136 # There is no need for this script in the tar file.
137 rm -f $ROOTNAME/make-tar.sh
139 # Remove build-artifacts.
140 find . -name "*.gz" -exec rm -rf {} \;
142 # Make the files writable...
145 tar cf - $ROOTNAME | gzip >"$DESTDIR/$ROOTNAME.tar.gz"
146 cd "$DESTDIR" || exit
149 ls -l $ROOTNAME.tar.gz