1 # Fluoride Bluetooth stack
3 ## Building and running on AOSP
4 Just build AOSP - Fluoride is there by default.
6 ## Building and running on Linux
8 Instructions for Ubuntu, tested on 14.04 with Clang 3.5.0 and 16.10 with Clang
11 ### Install required libraries
14 sudo apt-get install libevent-dev libc++-dev libc++abi-dev
17 ### Install build tools
19 - Install [ninja](https://ninja-build.org/) build system
22 sudo apt-get install ninja-build
25 or download binary from https://github.com/ninja-build/ninja/releases
27 - Install [gn](https://chromium.googlesource.com/chromium/src/tools/gn/) -
28 meta-build system that generates NinjaBuild files.
30 Get sha1 of current version from [here](
31 https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/gn.sha1)
32 and then download corresponding executable:
35 wget -O gn http://storage.googleapis.com/chromium-gn/<gn.sha1>
38 i.e. if sha1 is "3491f6687bd9f19946035700eb84ce3eed18c5fa" (value from 24 Feb
42 wget -O gn http://storage.googleapis.com/chromium-gn/3491f6687bd9f19946035700eb84ce3eed18c5fa
45 Then make binary executable and put it on your PATH, i.e.:
57 git clone https://android.googlesource.com/platform/system/bt
60 Then fetch third party dependencies:
66 git clone https://github.com/google/googletest.git
67 git clone https://android.googlesource.com/platform/external/libchrome
68 git clone https://android.googlesource.com/platform/external/modp_b64
69 git clone https://android.googlesource.com/platform/external/tinyxml2
70 git clone https://android.googlesource.com/platform/hardware/libhardware
73 And third party dependencies of third party dependencies:
76 cd fluoride/bt/third_party/libchrome/base/third_party
79 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h?format=TEXT | base64 -d > valgrind.h
80 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h
83 NOTE: If system/bt is checked out under AOSP, then create symbolic links instead
84 of downloading sources
90 ln -s ../../../external/libchrome libchrome
91 ln -s ../../../external/modp_b64 modp_b64
92 ln -s ../../../external/tinyxml2 tinyxml2
93 ln -s ../../../hardware/libhardware libhardware
94 ln -s ../../../external/googletest googletest
97 ### Generate your build files
108 ninja -C out/Default all
111 This will build all targets (the shared library, executables, tests, etc) and
112 put them in out/Default. To build an individual target, replace "all" with the
113 target of your choice, e.g. ```ninja -C out/Default net_test_osi```.
118 cd ~/fluoride/bt/out/Default
119 LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride
122 ### Eclipse IDE Support
124 1. Follows the Chromium project
125 [Eclipse Setup Instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_eclipse_dev.md)
126 until "Optional: Building inside Eclipse" section (don't do that section, we
127 will set it up differently)
129 2. Generate Eclipse settings:
133 gn gen --ide=eclipse out/Default
136 3. In Eclipse, do File->Import->C/C++->C/C++ Project Settings, choose the XML
137 location under system/bt/out/Default
139 4. Right click on the project. Go to Preferences->C/C++ Build->Builder Settings.
140 Uncheck "Use default build command", but instead using "ninja -C out/Default"
142 5. Goto Behaviour tab, change clean command to "-t clean"