+: "${ROOTNAME:=ncurses-Ada95}"
+: "${PKG_NAME:=AdaCurses}"
+: "${DESTDIR:=$TARGET}"
+: "${TMPDIR:=/tmp}"
+
+grep_assign() {
+ grep_assign=`grep -E "^$2\>" "$1" | sed -e "s/^$2[ ]*=[ ]*//" -e 's/"//g'`
+ eval "$2"=\""$grep_assign"\"
+}
+
+grep_patchdate() {
+ grep_assign ../dist.mk NCURSES_MAJOR
+ grep_assign ../dist.mk NCURSES_MINOR
+ grep_assign ../dist.mk NCURSES_PATCH
+}
+
+# The rpm spec-file in the ncurses tree is a template. Fill in the version
+# information from dist.mk
+edit_specfile() {
+ sed \
+ -e "s/\\<MAJOR\\>/$NCURSES_MAJOR/g" \
+ -e "s/\\<MINOR\\>/$NCURSES_MINOR/g" \
+ -e "s/\\<YYYYMMDD\\>/$NCURSES_PATCH/g" "$1" >"$1.new"
+ chmod u+w "$1"
+ mv "$1.new" "$1"
+}
+
+make_changelog() {
+ [ -f "$1" ] && chmod u+w "$1"
+ cat >"$1" <<EOF
+`echo $PKG_NAME|tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` ($NCURSES_MAJOR.$NCURSES_MINOR+$NCURSES_PATCH) unstable; urgency=low
+
+ * snapshot of ncurses subpackage for $PKG_NAME.
+
+ -- `head -n 1 "$HOME"/.signature` `date -R`
+EOF
+}
+
+# This can be run from either the subdirectory, or from the top-level