File tree Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+ SELF_DIR=" $( dirname $( readlink -f $0 ) ) "
5+ cd " $SELF_DIR "
6+
7+ function set_flag() {
8+ local append=false
9+
10+ if [[ " $1 " == " --append" ]]; then
11+ shift
12+ append=true
13+ fi
14+
15+ local var=" $1 " ; shift
16+ declare -n ref=" $var "
17+ if [[ " $ref " == " " ]]; then
18+ ref=" $@ "
19+ elif [[ " $append " == true ]]; then
20+ ref=" $ref $@ "
21+ fi
22+ }
23+
24+ DEFAULT_CXXFLAGS=" -std=c++11 -I ../include -shared -fPIC -s -O3 -ldl"
25+ DEFAULT_LDFLAGS=" "
26+ DEFAULT_CXX=g++
27+
28+ set_flag CXX $DEFAULT_CXX
29+ set_flag --append CXXFLAGS $DEFAULT_CXXFLAGS
30+ set_flag --append LDFLAGS $DEFAULT_LDFLAGS
31+
32+ while [[ " $1 " x != " " x ]]; do
33+ arg=" $1 " ; shift
34+ case " $arg " in
35+ --cxxflags=* ) CXXFLAGS=" ${arg## --cxxflags=} " ;;
36+ --ldflags=* ) LDFLAGS=" ${arg## --ldflags=} " ;;
37+ " --" ) break ;;
38+ esac
39+ done
40+
141mkdir -p build
242cd build
343mkdir -p imports
4- g++ -std=c++11 -I ../include -shared -fPIC -s -O3 ../regex.cpp -o ./imports/regex.cse
44+ $CXX $CXXFLAGS ../regex.cpp $LDFLAGS -o ./imports/regex.cse
45+
You can’t perform that action at this time.
0 commit comments