File: build.sh

package info (click to toggle)
libffi 3.5.2-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 4,056 kB
  • sloc: ansic: 39,406; asm: 14,495; sh: 3,567; exp: 815; makefile: 357; python: 319; perl: 171; cpp: 134
file content (46 lines) | stat: -rwxr-xr-x 1,135 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash

if ! [ -x "$(command -v emcc)" ]; then
  echo "Error: emcc could not be found." >&2
  exit 1
fi

set -e

SOURCE_DIR=$PWD

# Working directories
TARGET=$SOURCE_DIR/target
mkdir -p "$TARGET"

# Define default arguments
DEBUG=false

# Parse arguments
while [ $# -gt 0 ]; do
  case $1 in
    --debug) DEBUG=true ;;
    *) echo "ERROR: Unknown parameter: $1" >&2; exit 1 ;;
  esac
  shift
done

# Common compiler flags
export CFLAGS="-O3 -fPIC"
if [ "$DEBUG" = "true" ]; then export CFLAGS+=" -DDEBUG_F"; fi
export CXXFLAGS="$CFLAGS"

# Build paths
export CPATH="$TARGET/include"
export PKG_CONFIG_PATH="$TARGET/lib/pkgconfig"
export EM_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"

# Specific variables for cross-compilation
export CHOST="${TARGET_HOST}-unknown-linux" # wasm32-unknown-emscripten

autoreconf -fiv
emconfigure ./configure --host=$CHOST --prefix="$TARGET" --enable-static --disable-shared --disable-dependency-tracking \
  --disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs ${EXTRA_CONFIGURE_FLAGS}
make install
cp fficonfig.h target/include/
cp include/ffi_common.h target/include/