Skip to content

Commit e58daf1

Browse files
author
Spoike
committed
Enable building plugins for android.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5459 fc73d0e0-1445-4013-8a0c-d673dee63da5
1 parent 5e99d9b commit e58daf1

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

build_setup.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TARGETS_LINUX="qcc-rel rel dbg vk-rel plugins-rel plugins-dbg"
3737
TARGETS_WINDOWS="sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel"
3838

3939

40-
40+
PLUGINS_DROID="qi ezhud irc"
4141
PLUGINS_LINUXx86="ode qi ezhud xmpp irc"
4242
PLUGINS_LINUXx64="ode qi ezhud xmpp irc"
4343
PLUGINS_LINUXx32="qi ezhud xmpp irc"
@@ -176,6 +176,7 @@ if [ "$UID" != "0" ]; then
176176
echo "PLUGINS_LINUXx64=\"$PLUGINS_LINUXx64\"" >>$FTECONFIG
177177
echo "PLUGINS_LINUXx32=\"$PLUGINS_LINUXx32\"" >>$FTECONFIG
178178
echo "PLUGINS_LINUXarmhf=\"$PLUGINS_LINUXarmhf\"" >>$FTECONFIG
179+
echo "PLUGINS_DROID=\"$PLUGINS_DROID\"" >>$FTECONFIG
179180
fi
180181

181182
true

build_wip.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ if [ "$BUILD_MSVC" != "n" ]; then
158158
fi
159159
export NATIVE_PLUGINS="qi ezhud xmpp irc"
160160
if [ "$BUILD_ANDROID" != "n" ]; then
161-
build "Android" android droid-rel
161+
NATIVE_PLUGINS="$PLUGINS_DROID" build "Android" android droid-rel
162162
fi
163163
#if [ "$BUILD_WINDOWS" != "n" ]; then
164164
# build "NPFTE" npfte npfte-rel

engine/Makefile

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ STRIPFLAGS=--strip-unneeded --remove-section=.comment
66

77
CPUOPTIMIZATIONS=
88

9+
COMPILE_SYS:=$(shell uname -o 2>&1)
10+
911
#canonicalize the source path. except emscripten warns about that like crazy. *sigh*
1012
ifeq ($(FTE_TARGET),web)
1113
BASE_DIR:=.
1214
else ifeq ($(FTE_TARGET),droid)
13-
BASE_DIR:=.
15+
#android tools suck, but plugins need to find the engine directory.
16+
BASE_DIR:=../engine
1417
else
1518
BASE_DIR:=$(realpath .)
1619
endif
@@ -61,7 +64,6 @@ BULLETVER=2.87
6164
RELEASE_DIR=$(BASE_DIR)/release
6265
DEBUG_DIR=$(BASE_DIR)/debug
6366
PROFILE_DIR=$(BASE_DIR)/profile
64-
COMPILE_SYS:=$(shell uname -o 2>&1)
6567
NATIVE_ABSBASE_DIR:=$(realpath $(BASE_DIR))
6668
ifeq ($(COMPILE_SYS),Cygwin)
6769
OUT_DIR?=.
@@ -2122,10 +2124,10 @@ endif
21222124

21232125
droid-rel:
21242126
$(MAKE) FTE_TARGET=droid droid/build.xml droid/ftekeystore
2125-
$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-rel DROID_ARCH=$a; )
2127+
$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-rel plugins-rel DROID_ARCH=$a NATIVE_PLUGINS="$(NATIVE_PLUGINS)"; )
21262128
-rm -rf droid/libs
21272129
@$(foreach a, $(DROID_ARCH), mkdir -p droid/libs/$a; )
2128-
-@$(foreach a, $(DROID_ARCH), cp $(RELEASE_DIR)/m_droid-$a/libftedroid.so droid/libs/$a/libftedroid.so; )
2130+
-@$(foreach a, $(DROID_ARCH), cp $(RELEASE_DIR)/m_droid-$a/*.so droid/libs/$a/; )
21292131

21302132
@cd droid && $(ANT) release
21312133
ifneq ($(DROID_PACKSU),)
@@ -2159,10 +2161,10 @@ droid-opt:
21592161
#build FTE as a library, then build the java+package (release). also installs it onto the 'current' device.
21602162
droid-dbg:
21612163
$(MAKE) FTE_TARGET=droid droid/build.xml
2162-
$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-dbg DROID_ARCH=$a; )
2164+
$(foreach a, $(DROID_ARCH), $(MAKE) FTE_TARGET=droid m-dbg plugins-dbg DROID_ARCH=$a NATIVE_PLUGINS="$(NATIVE_PLUGINS)"; )
21632165
-rm -rf droid/libs
21642166
@$(foreach a, $(DROID_ARCH), mkdir -p droid/libs/$a; )
2165-
-@$(foreach a, $(DROID_ARCH), cp $(DEBUG_DIR)/m_droid-$a/libftedroid.so droid/libs/$a/libftedroid.so; )
2167+
-@$(foreach a, $(DROID_ARCH), cp $(DEBUG_DIR)/m_droid-$a/*.so droid/libs/$a/; )
21662168
@cd droid && $(ANT) debug #&& $(ANT) debug install
21672169
cp droid/bin/FTEDroid-debug.apk $(DEBUG_DIR)/FTEDroid.apk
21682170

plugins/Makefile

+27-15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw64-libs -lz
1515
PLUG_LDFLAGS_DL=
1616
endif
1717

18+
PLUG_PREFIX=$(OUT_DIR)/fteplug_
1819
PLUG_LDFLAGS_DL?=-ldl -static-libgcc
1920
PLUG_LDFLAGS?=-L/usr/local/lib -Wl,-R/usr/local/lib -lm
2021
PLUG_LDFLAGS_ZLIB?=-lz
@@ -65,6 +66,17 @@ ifeq ($(PLUG_NATIVE_EXT),)
6566
PLUG_NATIVE_EXT=_ppc.so
6667
endif
6768
endif
69+
ifeq ($(FTE_TARGET),droid)
70+
#plugins get written to the tmp build dir, to avoid conflicts
71+
PLUG_PREFIX=$(OUT_DIR)/m_droid-$(DROID_ARCH)/fteplug_
72+
#don't bother with cpu arch postfixes. they'll be in separate directories anyway.
73+
PLUG_NATIVE_EXT=.so
74+
#libresolv has no public api on android...
75+
LIBRESOLV=
76+
#so we know our target.
77+
PLUG_CFLAGS=-DANDROID
78+
PLUG_CXXFLAGS=-DANDROID
79+
endif
6880

6981
#fallback
7082
PLUG_NATIVE_EXT?=_unk.so
@@ -194,9 +206,9 @@ distclean:
194206
rm $(AV_BASE)$(AV_VER)-win32.zip
195207
rm $(AV_BASE)$(AV_VER)-win64.zip
196208

197-
$(OUT_DIR)/fteplug_ffmpeg$(PLUG_NATIVE_EXT): $(AV_DEP) $(FFMPEG_ZIP)
209+
$(PLUG_PREFIX)ffmpeg$(PLUG_NATIVE_EXT): $(AV_DEP) $(FFMPEG_ZIP)
198210

199-
$(OUT_DIR)/fteplug_ffmpeg$(PLUG_NATIVE_EXT): $(AVPLUG_OBJS)
211+
$(PLUG_PREFIX)ffmpeg$(PLUG_NATIVE_EXT): $(AVPLUG_OBJS)
200212
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -s -o $@ -shared $(PLUG_CFLAGS) $(AV_CFLAGS) $(AVPLUG_OBJS) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(AV_LDFLAGS)
201213

202214
#small script for ode
@@ -218,7 +230,7 @@ $(ODE_LIB): $(OUT_DIR)/../ode-$(ODE_VER).tar.gz
218230
cd $(ODE_BASE)ode-$(ODE_VER)/ && ./bootstrap && ./configure --enable-double-precision --disable-demos --without-x --with-pic CC="$(CC) $(PLUG_CXXFLAGS)" CXX="$(CC) $(PLUG_CXXFLAGS)" --host=`$(CC) -dumpmachine` && make
219231

220232
ODE_FILES=../engine/common/com_phys_ode.c ../engine/common/mathlib.c plugin.c qvm_api.c $(ODE_LIB)
221-
$(OUT_DIR)/fteplug_ode$(PLUG_NATIVE_EXT): $(ODE_FILES)
233+
$(PLUG_PREFIX)ode$(PLUG_NATIVE_EXT): $(ODE_FILES)
222234
$(CC) -flto -s $(BASE_CFLAGS) $(CFLAGS) -Os -DFTEPLUGIN -DODE_STATIC -o $@ -shared $(PLUG_CFLAGS) -I$(ODE_BASE)ode-$(ODE_VER)/include $(ODE_FILES) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -static-libgcc `$(CC) -print-file-name=libstdc++.a` -lpthread
223235
#NATIVE_PLUGINS+=ode
224236

@@ -243,22 +255,22 @@ $(BULLET_LIB): $(OUT_DIR)/../bullet3-$(BULLET_VER).tar.gz
243255
#./configure --enable-double-precision --disable-demos --without-x CXX="$(CC)" CFLAGS="$(PLUG_CFLAGS)" CXXFLAGS="$(PLUG_CXXFLAGS)" --host=`$(CC) -dumpmachine` && make
244256

245257

246-
$(OUT_DIR)/fteplug_bullet$(PLUG_NATIVE_EXT): bullet/bulletplug.cpp plugin.c qvm_api.c $(BULLET_LIBS)
258+
$(PLUG_PREFIX)bullet$(PLUG_NATIVE_EXT): bullet/bulletplug.cpp plugin.c qvm_api.c $(BULLET_LIBS)
247259
$(CXX) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(BULLET_CFLAGS)
248260
#NATIVE_PLUGINS+=bullet
249261

250262

251263
-include Makefile.private
252264

253-
$(OUT_DIR)/fteplug_mpq$(PLUG_NATIVE_EXT): mpq/fs_mpq.c mpq/blast.c plugin.c qvm_api.c
265+
$(PLUG_PREFIX)mpq$(PLUG_NATIVE_EXT): mpq/fs_mpq.c mpq/blast.c plugin.c qvm_api.c
254266
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Impq $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS_ZLIB) $(PLUG_LDFLAGS)
255267
NATIVE_PLUGINS+=mpq
256268

257-
$(OUT_DIR)/fteplug_xmpp$(PLUG_NATIVE_EXT): jabber/jabberclient.c jabber/jingle.c jabber/sift.c jabber/xml.c plugin.c qvm_api.c ../engine/common/sha1.c emailnot/md5.c
269+
$(PLUG_PREFIX)xmpp$(PLUG_NATIVE_EXT): jabber/jabberclient.c jabber/jingle.c jabber/sift.c jabber/xml.c plugin.c qvm_api.c ../engine/common/sha1.c emailnot/md5.c
258270
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Ijabber $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(LIBRESOLV)
259271
NATIVE_PLUGINS+=xmpp
260272

261-
$(OUT_DIR)/fteplug_qi$(PLUG_NATIVE_EXT): qi/qi.c jabber/xml.c plugin.c qvm_api.c
273+
$(PLUG_PREFIX)qi$(PLUG_NATIVE_EXT): qi/qi.c jabber/xml.c plugin.c qvm_api.c
262274
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Ijabber $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
263275
NATIVE_PLUGINS+=qi
264276

@@ -297,27 +309,27 @@ $(OUT_DIR)/cef_$(CEF_VER).zip: cef/$(CEF_NAME)/rel.zip
297309
cp cef/$(CEF_NAME)/rel.zip $@
298310

299311
CEF_SOURCES=cef/cef.c plugin.c qvm_api.c
300-
$(OUT_DIR)/fteplug_cef$(PLUG_NATIVE_EXT): $(CEF_SOURCES) $(OUT_DIR)/cef_$(CEF_VER).zip cef/$(CEF_NAME)/include/cef_version.h
301-
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $(OUT_DIR)/fteplug_cef$(PLUG_NATIVE_EXT) -shared $(PLUG_CFLAGS) -Icef/$(CEF_NAME) $(CEF_SOURCES) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -Wl,-rpath,. $(PLUG_LDFLAGS_DL)
312+
$(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT): $(CEF_SOURCES) $(OUT_DIR)/cef_$(CEF_VER).zip cef/$(CEF_NAME)/include/cef_version.h
313+
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT) -shared $(PLUG_CFLAGS) -Icef/$(CEF_NAME) $(CEF_SOURCES) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -Wl,-rpath,. $(PLUG_LDFLAGS_DL)
302314
#NATIVE_PLUGINS+=cef
303315
else
304-
.PHONEY: $(OUT_DIR)/fteplug_cef$(PLUG_NATIVE_EXT)
305-
$(OUT_DIR)/fteplug_cef$(PLUG_NATIVE_EXT):
316+
.PHONEY: $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT)
317+
$(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT):
306318
echo cef plugin not supported on this arch
307319
endif
308320

309321
#irc plugin can still be built as a qvm.
310-
$(OUT_DIR)/fteplug_irc$(PLUG_NATIVE_EXT): irc/ircclient.c plugin.c qvm_api.c
322+
$(PLUG_PREFIX)irc$(PLUG_NATIVE_EXT): irc/ircclient.c plugin.c qvm_api.c
311323
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iirc $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
312324
NATIVE_PLUGINS+=irc
313325

314326
#for compat with ezquake
315-
$(OUT_DIR)/fteplug_ezhud$(PLUG_NATIVE_EXT): ezhud/ezquakeisms.c ezhud/hud.c ezhud/hud_common.c ezhud/hud_editor.c plugin.c qvm_api.c
327+
$(PLUG_PREFIX)ezhud$(PLUG_NATIVE_EXT): ezhud/ezquakeisms.c ezhud/hud.c ezhud/hud_common.c ezhud/hud_editor.c plugin.c qvm_api.c
316328
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iezhud $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
317329
NATIVE_PLUGINS+=ezhud
318330

319-
$(OUT_DIR)/fteplug_models$(PLUG_NATIVE_EXT): models/gltf.c models/models.c plugin.c qvm_api.c
331+
$(PLUG_PREFIX)models$(PLUG_NATIVE_EXT): models/gltf.c models/models.c plugin.c qvm_api.c
320332
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Imodels $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
321333
#NATIVE_PLUGINS+=models
322334

323-
native: $(foreach FOO,$(NATIVE_PLUGINS), $(OUT_DIR)/fteplug_$(FOO)$(PLUG_NATIVE_EXT))
335+
native: $(foreach FOO,$(NATIVE_PLUGINS), $(PLUG_PREFIX)$(FOO)$(PLUG_NATIVE_EXT))

plugins/jabber/jabberclient.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ qboolean NET_DNSLookup_SRV(const char *host, char *out, int outlen)
601601
}
602602
return false;
603603
}
604-
#elif defined(__unix__) || defined(ANDROID) || defined(__MACH__) || defined(__linux__)
604+
#elif (defined(__unix__) || defined(__MACH__) || defined(__linux__)) && !defined(ANDROID)
605605
#include <resolv.h>
606606
#include <arpa/nameser.h>
607607
qboolean NET_DNSLookup_SRV(const char *host, char *out, int outlen)

0 commit comments

Comments
 (0)