Skip to content

Commit 8c638e6

Browse files
committedFeb 7, 2021
Build LV2 toolkits within the repo. No binary downloads anymore.
Fixes #11 serd, sord, sratom and lilv are now built as part of libandroidaudioplugin-lv2.so. We don't need pkg-config anymore, so any related scripts are gone. Also, this completely eliminates need for debuggable builds in README and relevant scripts.
1 parent 800d5cf commit 8c638e6

21 files changed

+151
-227
lines changed
 

‎.gitignore

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
*.iml
22
.idea
33
.gradle
4-
/local.properties
5-
/.idea/caches
6-
/.idea/libraries
7-
/.idea/modules.xml
8-
/.idea/workspace.xml
9-
/.idea/navEditor.xml
10-
/.idea/assetWizardSettings.xml
4+
local.properties
115
.DS_Store
12-
/build
6+
build
137
/captures
148
.externalNativeBuild
159
.cxx
1610
*.so
1711
*.lv2
18-
build
19-
cmake-build-debug
20-
symlinked-dist
21-
android-lv2-binaries.zip
22-
android-fluidsynth-dist.zip
23-
android-libsndfile-binaries.zip
24-
aap-guitarix-binaries.zip
2512
aap_metadata.xml

‎.gitmodules

+15
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,18 @@
44
[submodule "dependencies/android-audio-plugin-framework"]
55
path = dependencies/android-audio-plugin-framework
66
url = https://github.com/atsushieno/android-audio-plugin-framework.git
7+
[submodule "dependencies/serd"]
8+
path = dependencies/serd
9+
url = https://github.com/atsushieno/serd.git
10+
[submodule "dependencies/sord"]
11+
path = dependencies/sord
12+
url = https://github.com/atsushieno/sord.git
13+
[submodule "dependencies/sratom"]
14+
path = dependencies/sratom
15+
url = https://github.com/atsushieno/sratom.git
16+
[submodule "dependencies/lilv"]
17+
path = dependencies/lilv
18+
url = https://github.com/atsushieno/lilv.git
19+
[submodule "dependencies/lv2"]
20+
path = dependencies/lv2
21+
url = https://github.com/lv2/lv2.git

‎Makefile

+1-29
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,17 @@ all: build-all
55

66
build-all: \
77
build-aap-core \
8-
get-lv2-deps \
9-
import-lv2-deps \
8+
build-lv2-importer \
109
build-java
1110

1211
build-non-app: \
1312
build-aap-core \
14-
get-lv2-deps \
15-
import-lv2-deps \
1613
build-lv2-importer \
1714
build-java-core
1815

1916
build-aap-core:
2017
cd dependencies/android-audio-plugin-framework && make all-no-desktop
2118

22-
## downloads
23-
24-
get-lv2-deps: dependencies/lv2-deps/dist/stamp
25-
26-
dependencies/lv2-deps/dist/stamp: android-lv2-binaries.zip
27-
mkdir -p dependencies/lv2-deps
28-
unzip android-lv2-binaries -d dependencies/lv2-deps/
29-
./rewrite-pkg-config-paths.sh lv2-deps
30-
if [ ! -d androidaudioplugin-lv2/src/main/cpp/symlinked-dist ] ; then \
31-
ln -s `pwd`/dependencies/lv2-deps/dist androidaudioplugin-lv2/src/main/cpp/symlinked-dist ; \
32-
fi
33-
if [ ! -d aap-ayumi/src/main/symlinked-dist ] ; then \
34-
mkdir -p aap-ayumi/src/main ; \
35-
ln -s `pwd`/dependencies/lv2-deps/dist aap-ayumi/src/main/symlinked-dist ; \
36-
fi
37-
touch dependencies/lv2-deps/dist/stamp
38-
39-
android-lv2-binaries.zip:
40-
wget https://github.com/atsushieno/android-native-audio-builders/releases/download/r8.3/android-lv2-binaries.zip
41-
42-
# Run importers
43-
44-
import-lv2-deps: build-lv2-importer
45-
./import-lv2-deps.sh
46-
4719
## Build utility
4820

4921
build-lv2-importer:

‎README.md

+3-23
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ There are also dedicated repos for non-trivial LV2 plugin ports and so on:
99
- [aap-lv2-sfizz](https://github.com/atsushieno/aap-lv2-sfizz)
1010
- [aap-lv2-guitarix](https://github.com/atsushieno/aap-lv2-guitarix)
1111

12+
1213
## Building
1314

1415
There is a normative build script for GitHub Actions (see its `workflows.yml`), including dependencies.
@@ -164,8 +165,6 @@ External software projects:
164165

165166
To avoid further dependencies like cairo, we skip some samples in mda-lv2 port (they are actually skipped at android-native-audio-builders repo).
166167

167-
Also, unlike before, we don't build LV2 for desktop anymore. They are regarded as the installed packages on the system. Ubuntu 20.04 has those minimum requirement versions. If they don't exist for your distribution, build and install them from source and make it possible to be resolved via pkg-config.
168-
169168
### cerbero fork
170169

171170
The external dependencies are built using cerbero build system. Cerbero is a comprehensive build system that cares all standard Android ABIs and builds some complicated projects like glib (which has many dependencies) and cairo.
@@ -178,33 +177,14 @@ There are couple of lv2 related source repositories, namely serd and lilv. Their
178177

179178
And note that access to assets is not as simple as that to filesystem. It is impossible to enumerate assets at runtime. They have to be explicitly named and given. Therefore there are some plugin loader changes in our lilv fork.
180179

181-
182-
## Debugging with LV2 toolkit internals
183-
184-
To wrap this section up, we have `setup-hackable-environment.sh` bash script now. Now you can mostly skip the rest of this section if it just works for you. It will get outdated quite often though.
185-
186-
Sometimes having binary-only LV2 toolkits makes debugging difficult.
187-
To improve such a situation, we can build lilv and all the dependencies together
188-
within libandroidaudioplugin-lv2.so.
189-
This is a patch @atsushieno created for making it possible: https://gist.github.com/atsushieno/969eedaeefb51d99309a3234c2f9b8de
190-
191-
To use it, you will have to:
192-
193-
- create a directory `lilv_direct` in `androidaudioplugin-lv2/src/main/cpp/src` and go there. In that directory...
194-
- `ln -s /path/to/android-native-audio-builders/serd serd` as well as `sord`, `sratom` and `lilv`.
195-
- `cp /path/to/android-native-audio-builders/build/x86/serd/build/serd_config.h .` as well as `sord/build/sord_config.h`, `sratom/build/sratom_config.h` and `lilv/build/lilv_config.h` (it may require exact ABI, I used `x86` here)
196-
- Put these additional sources to the directory.
197-
- `abstract_io.c` https://raw.githubusercontent.com/atsushieno/serd/android/src/abstract_io.c
198-
- `abstract_io.h` https://raw.githubusercontent.com/atsushieno/serd/android/src/abstract_io.h
199-
- go back to topdir, and `rm -rf androidaudioplugin-lv2/src/main/jniLibs/`
200-
201-
Also note that depending on the build approaches, the gradle build scripts may not reach the tasks for copying lv2 resources. If they are missing in the apk, then it will fail to retrieve TTL files at instantiation time. Some `Makefile` lines do those jobs in normal builds, and sometimes you may have to do that manually here.
180+
Another thing to note is that we check in `serd_config.h`, `sord_config.h`, `sratom_config.h` and `lilv_config.h` directly in the source tree, which are generated from x86 build of android-native-audio-builders. If they have to be rebuilt (for e.g. updated submodules), rebuild and copy the generated headers again.
202181

203182

204183
## Performance measuring
205184

206185
`android-audio-plugin-lv2-bridge.cpp` has a simple performance measurement aid which can be enabled with JUCEAAP_LOG_PERF variable.
207186

187+
208188
## Licensing notice
209189

210190
aap-lv2 codebase is distributed under the MIT license.

‎aap-ayumi/src/main/CMakeLists.txt

+3-11
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,23 @@ project(ayumi-lv2 VERSION 0.1 LANGUAGES C)
88

99
if (ANDROID)
1010

11-
get_filename_component (LV2_DEP_DIST "${CMAKE_CURRENT_LIST_DIR}/symlinked-dist/${CMAKE_ANDROID_ARCH_ABI}" ABSOLUTE)
12-
set (ENV{PKG_CONFIG_PATH} "${LV2_DEP_DIST}/lib/pkgconfig/")
13-
1411
else (ANDROID)
1512

1613
get_filename_component (AAPDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../dependencies/android-audio-plugin-framework" ABSOLUTE)
17-
get_filename_component (LV2_DEP_DIST "${AAPDIR}/dependencies/lv2-desktop/dist" ABSOLUTE)
1814

1915
set (androidaudioplugin-lv2_INCLUDES
2016
"${AAPDIR}/native/plugin-api/include"
2117
"${AAPDIR}/native/androidaudioplugin/core/include")
2218

2319
endif (ANDROID)
2420

25-
find_package ( PkgConfig REQUIRED )
26-
27-
pkg_search_module ( LV2 REQUIRED lv2>=1.16.0 )
28-
2921
set (ayumi-lv2_INCLUDES
30-
${LV2_INCLUDE_DIRS}
22+
../../../dependencies/lv2
3123
)
3224

3325
set (ayumi-lv2_SOURCES
34-
${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/ayumi-lv2/ayumi.c
35-
${CMAKE_CURRENT_LIST_DIR}/../../../dependencies/ayumi-lv2/ayumi-lv2.c
26+
../../../dependencies/ayumi-lv2/ayumi.c
27+
../../../dependencies/ayumi-lv2/ayumi-lv2.c
3628
)
3729

3830
add_library ( # Specifies the name of the library.

‎androidaudioplugin-lv2/src/main/cpp/.gitignore

-2
This file was deleted.

‎androidaudioplugin-lv2/src/main/cpp/CMakeLists.txt

+58-30
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,25 @@
44

55
cmake_minimum_required(VERSION 3.6)
66

7-
project(androidaudioplugin-lv2 VERSION 0.1 LANGUAGES CXX)
7+
project(androidaudioplugin-lv2 VERSION 0.1 LANGUAGES C CXX)
8+
9+
set(DEPBASE ../../../../dependencies)
810

9-
# Android Studio is stupid. It tries to index your home directory if it references ancestor directories.
10-
# https://issuetracker.google.com/issues/159719671
11-
# Now it references descendant directory via symlink instead.
1211
if (ANDROID)
1312

1413
if (NOT (BUILD_WITH_PREFAB))
15-
get_filename_component (AAPDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../dependencies/android-audio-plugin-framework" ABSOLUTE)
14+
get_filename_component (AAPDIR "${DEPBASE}/android-audio-plugin-framework" ABSOLUTE)
1615
set (androidaudioplugin-lv2_INCLUDES
1716
"${AAPDIR}/native/plugin-api/include"
1817
"${AAPDIR}/native/androidaudioplugin/core/include")
1918
link_directories (
2019
"${AAPDIR}/java/androidaudioplugin/build/intermediates/merged_native_libs/debug/out/lib/${CMAKE_ANDROID_ARCH_ABI}"
2120
)
2221
endif ()
23-
get_filename_component (LV2_DEP_DIST "${CMAKE_CURRENT_LIST_DIR}/symlinked-dist/${CMAKE_ANDROID_ARCH_ABI}" ABSOLUTE)
24-
set (ENV{PKG_CONFIG_PATH} "${LV2_DEP_DIST}/lib/pkgconfig/")
2522

2623
else (ANDROID)
2724

28-
get_filename_component (AAPDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../dependencies/android-audio-plugin-framework" ABSOLUTE)
29-
get_filename_component (LV2_DEP_DIST "${AAPDIR}/dependencies/lv2-desktop/dist" ABSOLUTE)
25+
get_filename_component (AAPDIR "${CMAKE_CURRENT_LIST_DIR}/../../../${DEPBASE}/android-audio-plugin-framework" ABSOLUTE)
3026

3127
set (androidaudioplugin-lv2_INCLUDES
3228
"${AAPDIR}/native/plugin-api/include"
@@ -36,41 +32,77 @@ endif (ANDROID)
3632

3733
# resolve dependencies via pkg-config
3834

39-
find_package ( PkgConfig REQUIRED )
40-
41-
pkg_search_module ( LV2 REQUIRED lv2>=1.18.0 )
42-
pkg_search_module ( SERD REQUIRED serd-0>=0.28.0 )
43-
pkg_search_module ( SORD REQUIRED sord-0>=0.16.0 )
44-
pkg_search_module ( SRATOM REQUIRED sratom-0>=0.6.0 )
45-
pkg_search_module ( LILV REQUIRED lilv-0>=0.24.0 )
46-
4735
# set INCLUDE_DIRS and LIBRARY_DIRS
4836

4937
set (androidaudioplugin-lv2_INCLUDES
5038
${androidaudioplugin-lv2_INCLUDES}
5139
"src"
52-
${LV2_INCLUDE_DIRS}
53-
${SERD_INCLUDE_DIRS}
54-
${SORD_INCLUDE_DIRS}
55-
${SRATOM_INCLUDE_DIRS}
56-
${LILV_INCLUDE_DIRS}
40+
${DEPBASE}/serd/include
41+
${DEPBASE}/sord
42+
${DEPBASE}/lv2
43+
${DEPBASE}/sratom/include
44+
${DEPBASE}/lilv
5745
)
5846

5947
# target_link_directories is not usable until cmake 3.14...
6048
link_directories (
61-
${SERD_LIBRARY_DIRS}
62-
${SORD_LIBRARY_DIRS}
63-
${SRATOM_LIBRARY_DIRS}
64-
${LILV_LIBRARY_DIRS}
6549
)
6650

6751
# set SOURCES. Android build has some additional ones.
6852

53+
set(CMAKE_CXX_STANDARD 17)
54+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55+
set (androidaudioplugin-lv2_INCLUDES
56+
${DEPBASE}
57+
${DEPBASE}/serd/src
58+
${DEPBASE}/sord/src
59+
${DEPBASE}/lilv/src
60+
${androidaudioplugin-lv2_INCLUDES}
61+
)
62+
6963
set (androidaudioplugin-lv2_SOURCES
7064
"src/android-audio-plugin-lv2-bridge.cpp"
7165
"src/AudioPluginLV2LocalHost_native.cpp"
7266
"src/symap.cpp"
7367
"src/zix/ring.cpp"
68+
69+
"${DEPBASE}/lilv/src/plugin.c"
70+
"${DEPBASE}/lilv/src/pluginclass.c"
71+
"${DEPBASE}/lilv/src/filesystem.c"
72+
"${DEPBASE}/lilv/src/ui.c"
73+
"${DEPBASE}/lilv/src/util.c"
74+
"${DEPBASE}/lilv/src/state.c"
75+
"${DEPBASE}/lilv/src/lib.c"
76+
"${DEPBASE}/lilv/src/zix/tree.c"
77+
"${DEPBASE}/lilv/src/abstract_io.c"
78+
"${DEPBASE}/lilv/src/instance.c"
79+
"${DEPBASE}/lilv/src/node.c"
80+
"${DEPBASE}/lilv/src/world.c"
81+
"${DEPBASE}/lilv/src/query.c"
82+
"${DEPBASE}/lilv/src/scalepoint.c"
83+
"${DEPBASE}/lilv/src/collections.c"
84+
"${DEPBASE}/lilv/src/port.c"
85+
"${DEPBASE}/serd/src/base64.c"
86+
"${DEPBASE}/serd/src/writer.c"
87+
"${DEPBASE}/serd/src/system.c"
88+
"${DEPBASE}/serd/src/reader.c"
89+
"${DEPBASE}/serd/src/n3.c"
90+
# "${DEPBASE}/serd/src/abstract_io.c"
91+
# "${DEPBASE}/serd/src/serdi.c"
92+
"${DEPBASE}/serd/src/byte_source.c"
93+
"${DEPBASE}/serd/src/uri.c"
94+
"${DEPBASE}/serd/src/env.c"
95+
"${DEPBASE}/serd/src/node.c"
96+
"${DEPBASE}/serd/src/string.c"
97+
# "${DEPBASE}/sord/src/sordi.c"
98+
"${DEPBASE}/sord/src/sord_test.c"
99+
"${DEPBASE}/sord/src/syntax.c"
100+
# "${DEPBASE}/sord/src/sord_validate.c"
101+
"${DEPBASE}/sord/src/zix/hash.c"
102+
"${DEPBASE}/sord/src/zix/digest.c"
103+
"${DEPBASE}/sord/src/zix/btree.c"
104+
"${DEPBASE}/sord/src/sord.c"
105+
"${DEPBASE}/sratom/src/sratom.c"
74106
)
75107

76108

@@ -84,18 +116,15 @@ if (ANDROID)
84116
set (androidaudioplugin-lv2_LIBS
85117
android
86118
log
87-
${LILV_LIBRARIES}
88119
androidaudioplugin::androidaudioplugin)
89120
else (BUILD_WOTH_PREFAB)
90121
set (androidaudioplugin-lv2_LIBS
91122
android
92123
log
93-
${LILV_LIBRARIES}
94124
androidaudioplugin)
95125
endif (BUILD_WITH_PREFAB)
96126
else (ANDROID)
97127
set (androidaudioplugin-lv2_LIBS
98-
${LILV_LIBRARIES}
99128
androidaudioplugin)
100129
endif (ANDROID)
101130

@@ -106,7 +135,6 @@ target_include_directories (androidaudioplugin-lv2
106135

107136
target_compile_options (androidaudioplugin-lv2
108137
PRIVATE
109-
-std=c++17
110138
-Wall
111139
-Wshadow
112140
)

‎androidaudioplugin-lv2/src/main/cpp/src/AudioPluginLV2LocalHost_native.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#if ANDROID
1919

20+
extern AAssetManager *current_asset_manager;
21+
2022
namespace aaplv2 {
2123

2224
typedef void (*set_io_context_func)(void *);
@@ -40,9 +42,11 @@ void ensureDLLoaded() {
4042
}
4143

4244
void set_io_context(AAssetManager *am) {
43-
ensureDLLoaded();
44-
libserd_set_context(am);
45-
liblilv_set_context(am);
45+
//ensureDLLoaded();
46+
//libserd_set_context(am);
47+
//liblilv_set_context(am);
48+
49+
current_asset_manager = am;
4650
}
4751

4852
void cleanup() {

‎dependencies/lilv

Submodule lilv added at 65a9a42

‎dependencies/lilv_config.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* WARNING! All changes made to this file will be lost! */
2+
3+
#ifndef W_LILV_CONFIG_H_WAF
4+
#define W_LILV_CONFIG_H_WAF
5+
6+
#define LILV_CXX 1
7+
#define PYTHONDIR "/media/atsushi/extssd0/sources/android-native-audio-builders/dist/x86/lib/python3.8/site-packages"
8+
#define PYTHONARCHDIR "/media/atsushi/extssd0/sources/android-native-audio-builders/dist/x86/lib/python3.8/site-packages"
9+
#define LILV_VERSION "0.24.11"
10+
#define HAVE_LV2 1
11+
#define HAVE_SERD 1
12+
#define HAVE_SORD 1
13+
#define HAVE_SRATOM 1
14+
#define HAVE_SNDFILE 1
15+
#define HAVE_LSTAT 1
16+
#define HAVE_FLOCK 1
17+
#define HAVE_FILENO 1
18+
/* #undef HAVE_CLOCK_GETTIME */
19+
#define HAVE_LIBDL 1
20+
#define LILV_PATH_SEP ":"
21+
#define LILV_DIR_SEP "/"
22+
#define LILV_DEFAULT_LV2_PATH "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2"
23+
24+
#endif /* W_LILV_CONFIG_H_WAF */

‎dependencies/lv2

Submodule lv2 added at cd15210

‎dependencies/serd

Submodule serd added at 322adb1

0 commit comments

Comments
 (0)
Please sign in to comment.