-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_lib
executable file
·34 lines (28 loc) · 910 Bytes
/
build_lib
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
#!/bin/sh
#
# Build the librpi_serial_ext.so native library on the Raspberry Pi.
# The generated native library file is referenced by rpi_serial.dart via
# import 'dart-ext:rpi_serial_ext'
#
# Arguments: <buildScriptVersion> <DartSdkPath>
#
# Typically, this script is run by calling
#
# pub global run rpi_serial:build_lib
#
# See README for setup instructions
# exit on error
set -e
#DARTVM=$(readlink `which dart`)
#DARTBIN=$(dirname $DARTVM)
#DARTSDK=$(dirname $DARTBIN)
DARTSDK=$2
cd $(dirname $0)
echo building rpi_serial in `pwd`
####################################################################
# Build rpi_serial native library
g++ -fPIC -I$DARTSDK/ -c rpi_serial_ext.cc
# use --no-undefined to check for missing libraries
gcc -shared -lpthread -Wl,-soname,librpi_serial_ext.so -o librpi_serial_ext.so rpi_serial_ext.o
# Copy the library
cp librpi_serial_ext.so ../../librpi_serial_ext.so