summaryrefslogtreecommitdiffhomepage
path: root/samples/12_c_extensions/02_intermediate/pre.sh
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-10-13 00:45:16 -0500
committerAmir Rajan <[email protected]>2020-10-13 00:48:54 -0500
commit05cbef7fb8224332795e5685be499d81d20e7d93 (patch)
tree13ec5f1755c2f45618741f2f016ed8729dbedd41 /samples/12_c_extensions/02_intermediate/pre.sh
parentabad948c1154d88d79b9f891e3b7315540e0b0a3 (diff)
downloaddragonruby-game-toolkit-contrib-05cbef7fb8224332795e5685be499d81d20e7d93.tar.gz
dragonruby-game-toolkit-contrib-05cbef7fb8224332795e5685be499d81d20e7d93.zip
Synced with 1.26.
Diffstat (limited to 'samples/12_c_extensions/02_intermediate/pre.sh')
-rwxr-xr-xsamples/12_c_extensions/02_intermediate/pre.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/samples/12_c_extensions/02_intermediate/pre.sh b/samples/12_c_extensions/02_intermediate/pre.sh
new file mode 100755
index 0000000..405f205
--- /dev/null
+++ b/samples/12_c_extensions/02_intermediate/pre.sh
@@ -0,0 +1,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
+