| 1 | # Wedge definition for re2c.
 | 
| 2 | #
 | 
| 3 | # Loaded by deps/wedge.sh.
 | 
| 4 | 
 | 
| 5 | set -o nounset
 | 
| 6 | set -o pipefail
 | 
| 7 | set -o errexit
 | 
| 8 | 
 | 
| 9 | # sourced
 | 
| 10 | WEDGE_NAME='re2c'
 | 
| 11 | WEDGE_VERSION='3.0'
 | 
| 12 | WEDGE_IS_ABSOLUTE=1  # TODO: consider relaxing
 | 
| 13 | 
 | 
| 14 | wedge-make() {
 | 
| 15 |   local src_dir=$1
 | 
| 16 |   local build_dir=$2
 | 
| 17 |   local install_dir=$3
 | 
| 18 | 
 | 
| 19 |   pushd $build_dir
 | 
| 20 | 
 | 
| 21 |   $src_dir/configure --help
 | 
| 22 |   echo
 | 
| 23 | 
 | 
| 24 |   # This makes it smaller and faster!  Only 30 seconds
 | 
| 25 |   time $src_dir/configure \
 | 
| 26 |     --prefix=$install_dir \
 | 
| 27 |     --disable-golang --disable-rust
 | 
| 28 |   echo
 | 
| 29 | 
 | 
| 30 |   time make
 | 
| 31 | 
 | 
| 32 |   popd
 | 
| 33 | }
 | 
| 34 | 
 | 
| 35 | wedge-install() {
 | 
| 36 |   local build_dir=$1
 | 
| 37 | 
 | 
| 38 |   pushd $build_dir
 | 
| 39 | 
 | 
| 40 |   # install-strip is a GNU thing!  It discards symbols.
 | 
| 41 | 
 | 
| 42 |   # TODO: copy them from the original binary in $BUILD_DIR
 | 
| 43 |   # objcopy --add-debug-link, etc.
 | 
| 44 |   #
 | 
| 45 |   # /wedge/oilshell.org/symbols could be a separate thing.
 | 
| 46 | 
 | 
| 47 |   time make install-strip
 | 
| 48 | 
 | 
| 49 |   popd
 | 
| 50 | }
 | 
| 51 | 
 | 
| 52 | wedge-smoke-test() {
 | 
| 53 |   local install_dir=$1
 | 
| 54 | 
 | 
| 55 |   $install_dir/bin/re2c --version
 | 
| 56 | }
 | 
| 57 | 
 | 
| 58 | 
 | 
| 59 | #
 | 
| 60 | # Unused
 | 
| 61 | # 
 | 
| 62 | 
 | 
| 63 | strip-bin() {
 | 
| 64 |   ### UNUSED
 | 
| 65 | 
 | 
| 66 |   # Makes a big difference -- stripped binary is 674K, while unstriped is 12.5
 | 
| 67 |   # MB!
 | 
| 68 | 
 | 
| 69 |   strip -o $INSTALL_DIR/bin/re2c.stripped $INSTALL_DIR/bin/re2c
 | 
| 70 | }
 |