Skip to content

Commit

Permalink
split each library into a separate oasis section
Browse files Browse the repository at this point in the history
* wrote automation that glues everything together
* fixed bap-fsi-benchmark
* brute-forced uninstallation

Now, every feature that is provided by the bap repository is described
in a separate file in the oasis folder. The configure scripts is
responsible to glue them together based on the `--enable-<feature>`
options. There is a `--enable-everything` flag, that is useful for
testing and development. The default way of configuring from the source
repository would be:
```
  ./configure --enable-everything --prefix `opam config var prefix`
```
  • Loading branch information
ivg committed Mar 7, 2016
1 parent 804fb52 commit 3d80501
Show file tree
Hide file tree
Showing 35 changed files with 752 additions and 680 deletions.
24 changes: 8 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
SETUP = ocaml setup.ml -quiet
CONFIGURE = ./configure
PIQI=piqi
OCI=ocp-indent

build: setup.data setup.ml
build: setup.ml
$(SETUP) -build $(BAPBUILDFLAGS)

.PHONY: doc
doc:
ocaml bapdoc.ml

test: setup.data build
test: build
$(SETUP) -test $(BAPTESTFLAGS)

all: setup.data
all:
$(SETUP) -all $(BAPALLFLAGS)

install: setup.data
install:
$(SETUP) -install $(BAPINSTALLFLAGS)
sh tools/build_plugins.sh

uninstall: setup.data
uninstall:
$(SETUP) -uninstall $(BAPUNINSTALLFLAGS)

reinstall: setup.data
reinstall:
make uninstall
make install

clean: setup.data
clean:
$(SETUP) -clean $(BAPCLEANFLAGS)

distclean: setup.data
distclean:
$(SETUP) -distclean $(BAPDISTCLEANFLAGS)

setup.data: *.in _oasis
$(CONFIGURE) $(BAPCONFIGUREFLAGS)

configure:
$(CONFIGURE) $(BAPCONFIGUREFLAGS)

.PHONY: configure
.PHONY: clean disclean reinstall

.PHONY: check
Expand Down
12 changes: 3 additions & 9 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
rm -f _oasis

FST=true
WITHOUT_BAP_LIBRARY=false


for i in "$@"; do
if $FST; then
Expand All @@ -14,9 +14,6 @@ for i in "$@"; do
fi

case $i in
--without-library)
WITHOUT_BAP_LIBRARY=true
;;
--*=*)
ARG=${i%%=*}
VAL=${i##*=}
Expand All @@ -28,11 +25,8 @@ for i in "$@"; do
esac
done

if [ $WITHOUT_BAP_LIBRARY = "true" ]; then
ocaml tools/cat.ml oasis/common oasis/src _oasis
else
ocaml tools/cat.ml oasis/common oasis/bap oasis/src _oasis
fi
SECTIONS=`ocaml tools/oasis_sections.ml $@`
ocaml tools/cat.ml $SECTIONS _oasis
ocaml tools/cat.ml _tags.in _tags
ocaml tools/cat.ml myocamlbuild.ml.in myocamlbuild.ml
ocaml tools/cat.ml setup.ml.in setup.ml
Expand Down
38 changes: 38 additions & 0 deletions oasis/arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Flag arm
Description: Build ARM lifter
Default: false

Library "bap-arm"
XMETADescription: arm lifting
Path: lib/arm
Build$: flag(everything) || flag(arm)
BuildDepends: bap
FindlibName: bap-arm
Modules:
ARM,
Arm_bit,
Arm_branch,
Arm_cond,
Arm_env,
Arm_flags,
Arm_helpers,
Arm_insn,
Arm_lifter,
Arm_mem,
Arm_mem_shift,
Arm_mov,
Arm_mul,
Arm_op,
Arm_reg,
Arm_shift,
Arm_types,
Arm_utils


Library arm_plugin
Build$: flag(everything) || flag(arm)
Path: plugins/arm
FindlibName: bap-plugin-arm
BuildDepends: bap, bap-arm
InternalModules: Arm_main
XMETADescription: provide ARM lifter
121 changes: 18 additions & 103 deletions oasis/bap → oasis/bap-std
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Flag bap_std
Description: Build BAP Standard Library
Default: false

Library bap
Path: lib/bap
Build$: flag(everything) || flag(bap_std)
FindLibName: bap
CompiledObject: best
BuildDepends: bap.disasm,
Expand All @@ -10,40 +15,10 @@ Library bap
Modules: Bap
InternalModules: Bap_project, Bap_self

Library regular
Path: lib/regular
FindlibName: regular
CompiledObject: best
BuildDepends: core_kernel
Modules: Regular
InternalModules:
Regular_bytes,
Regular_cache,
Regular_data,
Regular_data_intf,
Regular_data_types,
Regular_data_write,
Regular_data_read,
Regular_opaque,
Regular_regular,
Regular_seq


Library graphlib
Path: lib/graphlib
FindlibName: graphlib
CompiledObject: best
BuildDepends: core_kernel, regular, ocamlgraph
Modules: Graphlib
InternalModules:
Graphlib_graph,
Graphlib_intf,
Graphlib_regular,
Graphlib_regular_intf,
Graphlib_pp

Library types
Path: lib/bap_types
Build$: flag(everything) || flag(bap_std)
FindlibParent: bap
FindlibName: types
CompiledObject: best
Expand Down Expand Up @@ -90,6 +65,7 @@ Library types

Library bap_image
Path: lib/bap_image/
Build$: flag(everything) || flag(bap_std)
FindlibParent: bap
FindlibName: image
BuildDepends: bap.types
Expand All @@ -106,6 +82,7 @@ Library bap_image

Library disasm
Path: lib/bap_disasm
Build$: flag(everything) || flag(bap_std)
FindlibParent: bap
FindlibName: disasm
BuildDepends: bap.image,
Expand Down Expand Up @@ -140,6 +117,7 @@ Library disasm
CSources: disasm.h, disasm.c, disasm_stubs.c

Library sema
Build$: flag(everything) || flag(bap_std)
Path: lib/bap_sema
FindlibParent: bap
FindlibName: sema
Expand All @@ -153,13 +131,15 @@ Library sema
Bap_sema_free_vars

Library plugins
Build$: flag(everything) || flag(bap_std)
Path: lib/bap_plugins
FindLibParent: bap
FindLibName: plugins
Modules: Bap_plugins
BuildDepends: core_kernel, dynlink, fileutils, findlib, bap.bundle, bap.config

Library "bap-build"
Build$: flag(everything) || flag(bap_std)
Path: lib/bap_build
FindlibName: bap-build # will rename later
#FindlibParent: bap
Expand All @@ -169,8 +149,8 @@ Library "bap-build"


Library top
XMETADescription:
Toplevel printers for bap-types and core_kernel
XMETADescription: Toplevel printers for bap-types and core_kernel
Build$: flag(everything) || flag(bap_std)
Path: lib/bap
FindLibParent: bap
FindLibName: top
Expand All @@ -185,105 +165,40 @@ Library top
bap.config

Library config
Build$: flag(everything) || flag(bap_std)
Path: lib/bap_config
FindlibParent: bap
FindlibName: config
Modules: Bap_config


Library bundle
Build$: flag(everything) || flag(bap_std)
Path: lib/bap_bundle
FindlibParent: bap
FindlibName: bundle
BuildDepends: uri, camlzip, unix, bap.config
Modules: Bap_bundle

Library types_test
Path: lib_test/bap_types
Build$: flag(tests)
Install: false
CompiledObject: best
BuildDepends: bap, oUnit
Modules: Test_bitvector,
Test_bili,
Test_bytes,
Test_graph,
Test_trie

Library image_test
Path: lib_test/bap_image
Build$: flag(tests)
CompiledObject: best
BuildDepends: bap, oUnit
Install: false
Modules: Test_image,
Test_memmap,
Test_table

Library project_test
Path: lib_test/bap_project
Build$: flag(tests)
CompiledObject: best
BuildDepends: bap, oUnit
Install: false
Modules: Test_project

Library disasm_test
Path: lib_test/bap_disasm
Build$: flag(tests)
CompiledObject: best
BuildDepends: bap, oUnit
Install: false
Modules: Test_disasm

Library sema_test
Path: lib_test/bap_sema
Build$: flag(tests)
CompiledObject: best
BuildDepends: bap, oUnit
Install: false
Modules: Test_ir


Executable run_tests
Path: lib_test/bap
MainIs: run_tests.ml
Install: false
Build$: flag(tests)
BuildDepends: bap.plugins,
disasm_test,
image_test,
oUnit,
sema_test,
types_test,
project_test,
findlib.dynload
CompiledObject: best


Test unit_tests
TestTools: run_tests
Command: $run_tests -runner sequential

Test inline_tests
TestTools: run_tests
Command: $run_tests inline-test-runner bap -show-counts

Executable "bapbuild"
Build$: flag(everything) || flag(bap_std)
Path: tools
MainIs: bapbuild.ml
Install: true
CompiledObject: best
BuildDepends: core_kernel, ocamlbuild, bap-build, compiler-libs

Executable "bapbundle"
Build$: flag(everything) || flag(bap_std)
Path: tools
MainIs: bapbundle.ml
Install: true
CompiledObject: best
BuildDepends: core_kernel, bap.bundle, fileutils

Executable "postinstall"
Build$: flag(everything) || flag(bap_std)
Path: tools
MainIs: postinstall.ml
Install: false
Expand Down
26 changes: 26 additions & 0 deletions oasis/benchmarks
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
########## Benchmarking ###########################
Flag benchmarks
Description: Build and run benchmarks
Default: false

Library benchmarks
Path: benchmarks
Build$: flag(tests) && flag(benchmarks)
CompiledObject: best
BuildDepends: bap, core, core_bench, threads
Install: false
Modules: Bench_dom, Bench_image


Executable run_benchmarks
Path: benchmarks
MainIs: run_benchmarks.ml
Install: false
Build$: flag(tests) && flag(benchmarks)
BuildDepends: bap, benchmarks
CompiledObject: native

Test benchmarks
TestTools: run_benchmarks
Run$: flag(tests) && flag(benchmarks)
Command: $run_benchmarks
20 changes: 20 additions & 0 deletions oasis/byteweight
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Flag byteweight
Description: Build byteweight library
Default: false

Library byteweight
Path: lib/bap_byteweight
FindLibName: bap-byteweight
Build$: flag(everything) || flag(byteweight)
CompiledObject: best
Modules: Bap_byteweight, Bap_byteweight_signatures
BuildDepends: bap, core_kernel, uri

Library byteweight_plugin
Path: plugins/byteweight
FindlibName: bap-plugin-byteweight
Build$: flag(everything) || flag(byteweight)
CompiledObject: best
BuildDepends: bap, bap-byteweight, cmdliner
InternalModules: Byteweight_main
XMETADescription: find function starts using Byteweight algorithm
Loading

0 comments on commit 3d80501

Please sign in to comment.