Fixes curl load which was broken with the last commit
If alsa doesn't exist on the target, it doesn't do us any good to bundle our own lib-alsa. Instead, we build a dummy, link against it, then use the target's lib at runtime. For that reason, we don't bother packaging it. Confirmed working audio playback on amlogic m1 (after jumping through some hoops there).
This might be the ugliest hack yet. I can only hope that someone comes up with a more clever way to handle the following problem without too much overhaul: When a lib is dlopened in android, bionic will try to resolve all symbols in that lib. It will use the DT_NEEDED entries in the lib to load those libs and look for symbols, and thanks to our recursive loader, subsequent DT_NEEDED entries in those deps will be checked as well. If any missing symbols are found anywhere in that chain, the dlopen will abort. This presents a problem with our wrapped libs. As an example, we compile cximage along with our wrapper.o so that the __wrap functions are picked up. However, that means that our dll_* functions are also included in the lib as unresolved dependencies. Thus, cximage will fail to load when dlopened. The (even uglier) solution to that is to link cximage and all of our wrapped libs against libxbmc.so, so that the dll_* functions can be resolved at runtime. However, that approach creates a buildsystem nightmare where libxbmc.so must exist before compiling our other libs. This "fix" instead uses a dummy libxbmc.so that our libs can link against before the real libxbmc.so is built. This way, libxbmc.so is added to DT_NEEDED in the elf header, and the symbols can be loaded correctly. The contents of the dummy lib are irrelevant, all that matters is that the DT_NEEDED entry is added. I could not find a reliable way to add this entry to and elf in a way that android would recognize it. Things I tried before resigning to this: 1. Using weak symbols to create phony entries for dll_* in libxbmcapp.so. Bionic is nice enough to store the weak symbols and ignore those that should override them. Ugh. 2. DT_AUXILIARY. Bionic apparently ignores them completely. 3. dlsym for each dll_*. Far too much copy/paste there, and rough to automate. 4. Splitting the dll_* out of wrapper.so with some ifdef hackery. I looked at some options here, but all of my ideas would just mean other undefined symbols somewhere else. 5. Using objdump/objcopy to move symbols from wrapper.o to libxbmcapp.so. I concluded that this wouldn't help as it would lead to more dependency problems, but someone more well-versed in the subject might conclude otherwise. 6. Manual -lxbmc for all wrapped libs. This is how it worked before adding this new hack. It's ugly. In my opinion a phony lib is better, but I don't expect everyone to agree.