summaryrefslogtreecommitdiffhomepage
path: root/samples/12_c_extensions/02_intermediate/pre.sh
blob: 405f2053c6c34798ccf94ac8281ea235d9f58a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

OSTYPE=`uname -s`
if [ "x$OSTYPE" = "xDarwin" ]; then
  PLATFORM=macos
  DLLEXT=dylib
else
  PLATFORM=linux-amd64
  DLLEXT=so
fi

DRB_ROOT=../../..
mkdir -p native/$PLATFORM

$DRB_ROOT/dragonruby-bind -ffi-module=RE --output=native/re-bindings.c app/re.h
clang \
  -isystem $DRB_ROOT/include -I. \
  -fPIC -shared app/re.c native/re-bindings.c -o native/$PLATFORM/ext.$DLLEXT