-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from cellar-wg/update-to-xml2rfc-version-3-pr…
…ocessing Update to xml2rfc version 3 processing
- Loading branch information
Showing
18 changed files
with
523 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/bin/sh | ||
# | ||
# bootstrap script to get the tools needed to build the specs within a UNIX shell | ||
|
||
export LC_ALL= | ||
FOUND= | ||
NEEDED= | ||
|
||
BOOTSTRAP_MAKE=bootstrap.mak | ||
RUNTIMES_MAKE=runtimes.mak | ||
|
||
check_version() { | ||
gotver=$2 | ||
gotmajor=`echo $gotver|cut -d. -f1` | ||
gotminor=`echo $gotver|cut -d. -f2|cut -d+ -f1` | ||
gotmicro=`echo $gotver|cut -d. -f3|cut -d+ -f1` | ||
[ -z "$gotmicro" ] && gotmicro=0 | ||
needmajor=`echo $3|cut -d. -f1` | ||
needminor=`echo $3|cut -d. -f2` | ||
needmicro=`echo $3|cut -d. -f3` | ||
[ -z "$needmicro" ] && needmicro=0 | ||
if [ "$needmajor" -ne "$gotmajor" \ | ||
-o "$needmajor" -eq "$gotmajor" -a "$needminor" -gt "$gotminor" \ | ||
-o "$needmajor" -eq "$gotmajor" -a "$needminor" -eq "$gotminor" -a "$needmicro" -gt "$gotmicro" ] | ||
then | ||
echo "$1 too old (got $gotver, needed $3)" | ||
NEEDED="$NEEDED $1" | ||
else | ||
FOUND="$FOUND $1" | ||
echo "found $1 version $2 (needed $3)" | ||
fi | ||
} | ||
|
||
check() { | ||
if ! $1 --version >/dev/null 2>&1 && ! $1 -version >/dev/null 2>&1 | ||
then | ||
echo "$1 not found" | ||
NEEDED="$NEEDED $1" | ||
else | ||
# found, need to check version ? | ||
if [ -z "$2" ];then | ||
FOUND="$FOUND $1" | ||
echo "found $1" | ||
else | ||
gotver=`$1 --version | head -1 | sed s/'.* '//` | ||
check_version $1 $gotver $2 | ||
fi | ||
fi | ||
} | ||
|
||
# check make | ||
check mmark 2.1.1 | ||
check xml2rfc 2.30.0 | ||
# apt install xsltproc | ||
check xsltproc 1.1.0 | ||
# apt install libxml2-utils | ||
check xmllint 20903 | ||
|
||
cat > $BOOTSTRAP_MAKE << EOF | ||
PREFIX=\$(abspath ./build) | ||
EOF | ||
|
||
echo "# calls the local or installed tool " > $RUNTIMES_MAKE | ||
|
||
for t in $FOUND; do | ||
echo ".$t:" >> $BOOTSTRAP_MAKE | ||
echo "$t" | awk '{ tool = sprintf("%s_CALL := %s", toupper($0), $0); print tool }' >> $RUNTIMES_MAKE | ||
done | ||
|
||
for t in $NEEDED; do | ||
echo .$t: .build$t >> $BOOTSTRAP_MAKE | ||
PACKAGES="$PACKAGES $t" | ||
TARGETS="$TARGETS .build$t" | ||
if [ $t = "xml2rfc" ]; then | ||
# installed in the Python local user dir | ||
PYTHON_USER_PATH=$(python -m site --user-base) | ||
echo PYTHON_USER_PATH=$PYTHON_USER_PATH >> $RUNTIMES_MAKE | ||
echo "$t" | awk '{ tool = sprintf("%s_CALL := $(PYTHON_USER_PATH)/bin/%s", toupper($0), $0); print tool }' >> $RUNTIMES_MAKE | ||
else | ||
echo "$t" | awk '{ tool = sprintf("%s_CALL := ./%s", toupper($0), $0); print tool }' >> $RUNTIMES_MAKE | ||
fi | ||
done | ||
|
||
[ -n "$PACKAGES" ] && echo "To-be-built packages: $PACKAGES" | ||
|
||
case `uname` in | ||
Linux) | ||
MMARK_OS=linux | ||
;; | ||
Darwin) | ||
MMARK_OS=darwin | ||
;; | ||
MINGW32*|MINGW64*|*MSYS*) | ||
MMARK_OS=windows | ||
;; | ||
*) | ||
echo Unsupported build OS `uname` | ||
exit 1 | ||
;; | ||
esac | ||
case `uname -m` in | ||
x86_64) | ||
MMARK_MACHINE=amd64 | ||
;; | ||
arm64) | ||
MMARK_MACHINE=arm64 | ||
;; | ||
arm) | ||
MMARK_MACHINE=arm | ||
;; | ||
*) | ||
echo Unsupported build CPU `uname -m` | ||
exit 1 | ||
;; | ||
esac | ||
|
||
cat >> $BOOTSTRAP_MAKE << EOF | ||
all: $TARGETS | ||
@echo "You are ready to build Matroska specifications" | ||
MMARK_VERSION=2.1.1 | ||
MMARK_OS=$MMARK_OS | ||
MMARK_MACHINE=$MMARK_MACHINE | ||
include tools.mak | ||
EOF | ||
|
||
make -f $BOOTSTRAP_MAKE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.