Make servald_features() available to iOS app

Add servald_features.o to the libservaldaemon.a static library (was only
in libservaldaemon.so before), and create the "servald_features.h"
public header so that an iOS app's Swift code can simply refer to the
servald_features() function in order to link in all the Serval DNA
daemon features.
This commit is contained in:
Andrew Bettison 2018-06-01 11:07:00 +09:30
parent 33518fd286
commit 00804e9fc1
4 changed files with 43 additions and 6 deletions

View File

@ -354,21 +354,36 @@ $(SIMULATOR_OBJS): Makefile $(CONFIG_H) $(PREFIXED_HEADERS) $(LIBSODIUM_HEADER
# Rules for main targets.
# The daemon static library. This is linked into any statically-linked daemon,
# such as the Swift Daemon API module's static library, and contains all the
# features of the full Serval DNA daemon. It includes servald_features.o so
# that a statically-linked server can simply reference servald_features() in
# order to force all the features to be linked in. It also includes all the
libservaldaemon.a: _servald.a $(LIBSODIUM_A)
@$(call MERGE_STATIC_LIBS, $@, $^)
# This intermediate library exists only so that libservaldaemon.a can be
# constructed by merging two static libraries.
.INTERMEDIATE: _servald.a
_servald.a: $(SERVALD_OBJS) $(OBJSDIR_TOOLS)/version.o
_servald.a: $(SERVALD_OBJS) \
$(OBJSDIR_TOOLS)/version.o \
$(OBJSDIR_SERVALD)/servald_features.o
@echo AR $@
@$(RM) $@
@$(AR) -cr $@ $^
libservaldaemon.a: _servald.a $(LIBSODIUM_A)
@$(call MERGE_STATIC_LIBS, $@, $^)
# The daemon shared library. This is linked in at run-time by the JNI
# interface using dlopen(3). The servald_features.o object is explicitly
# included here, even though it is also available in libservaldaemon.a, because
# without it, many feature-specific .o object files would not be pulled into
# the shared library, and the Java API would then fail at run-time with errors
# like:
# java.lang.UnsatisfiedLinkError: libservaldaemon.so: undefined symbol: __stop_httpd
libservaldaemon.so: \
$(OBJSDIR_SERVALD)/servald_features.o \
$(OBJSDIR_SERVALD)/log_output_console.o \
$(SERVAL_DAEMON_JNI_OBJS) \
_servald.a \
$(LIBSODIUM_A)
libservaldaemon.a
@echo LINK $@
@$(CC) -Wall -shared -o $@ $(LDFLAGS) $(filter %.o, $^) $(filter %.a, $^)

View File

@ -33,6 +33,7 @@ LIB_HDRS= \
# are exposed by the iOS framework module, so they are accessible to Swift code
# in Xcode projects.
PUBLIC_HDRS= \
servald_features.h \
commandline.h \
constants.h \
conf.h \

View File

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "servald_features.h"
#include "feature.h"
void servald_features()

20
servald_features.h Normal file
View File

@ -0,0 +1,20 @@
/*
Serval DNA daemon features
Copyright (C) 2018 Flinders University
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
void servald_features();