build-common

Shared build system code (usually as a git submodule)
Log | Files | Refs | README | LICENSE

configure (2085B)


      1 #!/bin/sh
      2 
      3 # This file is part of GNU Taler.
      4 # (C) 2020 Taler Systems S.A.
      5 #
      6 # Permission to use, copy, modify, and/or distribute this software for any
      7 # purpose with or without fee is hereby granted.
      8 #
      9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
     12 # LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
     13 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     14 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     15 # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
     16 # THIS SOFTWARE.
     17 #
     18 # SPDX-License-Identifier: 0BSD
     19 
     20 # This script checks if a suitable python3 executable is installed and then
     21 # executes the actual configure logic written in Python.
     22 
     23 build_system_dir=build-system
     24 
     25 if ! test -d "$build_system_dir"; then
     26   # Maybe this is not a top-level configure invocation
     27   # For monorepos, try location from top-level
     28   build_system_dir=../../build-system
     29 fi
     30 
     31 if ! test -d "$build_system_dir"; then
     32   echo "fatal error: build-system directory not found" >&2
     33   echo "hint: are you running this script from the right directory?" >&2
     34   exit 1
     35 fi
     36 
     37 scriptpath=$build_system_dir/taler-build-scripts
     38 if ! test -d "$build_system_dir"; then
     39   echo "fatal error: taler-build-scripts directory not found at $scriptpath" >&2
     40   echo "hint: did you run './bootstrap'?" >&2
     41   exit 1
     42 fi
     43 
     44 export TALERBUILDSYSTEMDIR=$build_system_dir
     45 
     46 # Check that the python3 executable is on the PATH.
     47 # This follows PEP 394 (https://www.python.org/dev/peps/pep-0394/).
     48 if ! python3 --version >/dev/null 2>&1; then
     49   echo "error: python3 not found" >&2
     50   exit 1
     51 fi
     52 
     53 # Let python3 check that its own version is okay for us.
     54 python3 "$scriptpath/pyvercheck.py" || exit $?
     55 
     56 # Allow Python to find libraries that are checked into the build system git.
     57 export PYTHONPATH="$scriptpath:${PYTHONPATH:-}"
     58 
     59 # Call configure.py, assuming all went well.
     60 python3 $TALERBUILDSYSTEMDIR/configure.py "$@"