summaryrefslogtreecommitdiffhomepage
path: root/samples/12_c_extensions/01_basics/pre.sh
blob: 07965a5a6f8c2a81e258a6afdf9076c9d6446636 (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 --output=native/ext-bindings.c app/ext.c
clang \
  -isystem $DRB_ROOT/include -I. \
  -fPIC -shared native/ext-bindings.c -o native/$PLATFORM/ext.$DLLEXT