mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-29 02:07:55 +02:00
snapserver compiles in Android
This commit is contained in:
parent
8ae203eece
commit
025cd0e084
7 changed files with 44 additions and 11 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -13,3 +13,6 @@
|
||||||
[submodule "externals/tremor"]
|
[submodule "externals/tremor"]
|
||||||
path = externals/tremor
|
path = externals/tremor
|
||||||
url = https://git.xiph.org/tremor.git
|
url = https://git.xiph.org/tremor.git
|
||||||
|
[submodule "externals/vorbis"]
|
||||||
|
path = externals/vorbis
|
||||||
|
url = https://git.xiph.org/vorbis.git
|
||||||
|
|
|
@ -36,7 +36,7 @@ else ifeq ($(TARGET), MACOS)
|
||||||
|
|
||||||
CXX = /usr/bin/g++
|
CXX = /usr/bin/g++
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
CXXFLAGS += -DHAS_OGG -DHAS_COREAUDIO -DFREEBSD -DMACOS -DHAS_BONJOUR -I/usr/local/include -Wno-unused-local-typedef -Wno-deprecated
|
CXXFLAGS += -DHAS_OGG -DHAS_COREAUDIO -DFREEBSD -DMACOS -DHAS_BONJOUR -DHAS_DAEMON -I/usr/local/include -Wno-unused-local-typedef -Wno-deprecated
|
||||||
LDFLAGS = -logg -lvorbis -lFLAC -L/usr/local/lib -framework AudioToolbox -framework CoreFoundation
|
LDFLAGS = -logg -lvorbis -lFLAC -L/usr/local/lib -framework AudioToolbox -framework CoreFoundation
|
||||||
OBJ += player/coreAudioPlayer.o browseZeroConf/browseBonjour.o
|
OBJ += player/coreAudioPlayer.o browseZeroConf/browseBonjour.o
|
||||||
|
|
||||||
|
|
7
externals/build_externals_android.sh
vendored
7
externals/build_externals_android.sh
vendored
|
@ -17,6 +17,13 @@ make
|
||||||
make install
|
make install
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
|
cd ../vorbis
|
||||||
|
./autogen.sh
|
||||||
|
./configure --host=arm --prefix=$NDK_DIR --with-ogg=$NDK_DIR
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
make clean
|
||||||
|
|
||||||
cd ../tremor
|
cd ../tremor
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --host=arm --prefix=$NDK_DIR --with-ogg=$NDK_DIR
|
./configure --host=arm --prefix=$NDK_DIR --with-ogg=$NDK_DIR
|
||||||
|
|
1
externals/vorbis
vendored
Submodule
1
externals/vorbis
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 143caf4023a90c09a5eb685fdd46fb9b9c36b1ee
|
|
@ -9,41 +9,49 @@ else
|
||||||
TARGET_DIR ?= /usr
|
TARGET_DIR ?= /usr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS += -std=c++0x -Wall -Wno-unused-function -O3 -DASIO_STANDALONE -DVERSION=\"$(VERSION)\" -I. -I.. -I../externals/asio/asio/include -I../externals/popl/include
|
CXXFLAGS += $(ADD_CFLAGS) -std=c++0x -Wall -Wno-unused-function -O3 -DASIO_STANDALONE -DVERSION=\"$(VERSION)\" -I. -I.. -I../externals/asio/asio/include -I../externals/popl/include
|
||||||
|
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC
|
||||||
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o ../common/log.o ../common/sampleFormat.o ../message/pcmChunk.o
|
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o json/jsonrpc.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o ../common/log.o ../common/sampleFormat.o ../message/pcmChunk.o
|
||||||
|
|
||||||
ifeq ($(ENDIAN), BIG)
|
ifeq ($(ENDIAN), BIG)
|
||||||
CXXFLAGS += -DIS_BIG_ENDIAN
|
CXXFLAGS += -DIS_BIG_ENDIAN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), OPENWRT)
|
ifeq ($(TARGET), ANDROID)
|
||||||
|
|
||||||
|
CXX = $(NDK_DIR)/bin/arm-linux-androideabi-g++
|
||||||
|
STRIP = $(NDK_DIR)/bin/arm-linux-androideabi-strip
|
||||||
|
CXXFLAGS += -pthread -DANDROID -DNO_CPP11_STRING -fPIC -I$(NDK_DIR)/include
|
||||||
|
LDFLAGS += -L$(NDK_DIR)/lib -pie
|
||||||
|
|
||||||
|
else ifeq ($(TARGET), OPENWRT)
|
||||||
|
|
||||||
STRIP = echo
|
STRIP = echo
|
||||||
CXXFLAGS += -DNO_CPP11_STRING -DHAS_AVAHI -pthread
|
CXXFLAGS += -DNO_CPP11_STRING -DHAS_AVAHI -DHAS_DAEMON -pthread
|
||||||
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -latomic
|
LDFLAGS += -lavahi-client -lavahi-common -latomic
|
||||||
OBJ += publishZeroConf/publishAvahi.o
|
OBJ += publishZeroConf/publishAvahi.o
|
||||||
|
|
||||||
else ifeq ($(TARGET), FREEBSD)
|
else ifeq ($(TARGET), FREEBSD)
|
||||||
|
|
||||||
CXX = /usr/local/bin/g++
|
CXX = /usr/local/bin/g++
|
||||||
STRIP = echo
|
STRIP = echo
|
||||||
CXXFLAGS += -DNO_CPP11_STRING -DFREEBSD -DHAS_AVAHI -pthread
|
CXXFLAGS += -DNO_CPP11_STRING -DFREEBSD -DHAS_AVAHI -DHAS_DAEMON -pthread
|
||||||
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
LDFLAGS += -lrt -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
||||||
OBJ += publishZeroConf/publishAvahi.o
|
OBJ += publishZeroConf/publishAvahi.o
|
||||||
|
|
||||||
else ifeq ($(TARGET), MACOS)
|
else ifeq ($(TARGET), MACOS)
|
||||||
|
|
||||||
CXX = /usr/bin/g++
|
CXX = /usr/bin/g++
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
CXXFLAGS += -DFREEBSD -DMACOS -DHAS_BONJOUR -Wno-deprecated -I/usr/local/include
|
CXXFLAGS += -DFREEBSD -DMACOS -DHAS_BONJOUR -DHAS_DAEMON -Wno-deprecated -I/usr/local/include
|
||||||
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC -L/usr/local/lib
|
LDFLAGS += -L/usr/local/lib
|
||||||
OBJ += publishZeroConf/publishBonjour.o
|
OBJ += publishZeroConf/publishBonjour.o
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
CXX = /usr/bin/g++
|
CXX = /usr/bin/g++
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
CXXFLAGS += -DHAS_AVAHI -pthread
|
CXXFLAGS += -DHAS_AVAHI -DHAS_DAEMON -pthread
|
||||||
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
|
||||||
OBJ += publishZeroConf/publishAvahi.o
|
OBJ += publishZeroConf/publishAvahi.o
|
||||||
|
|
||||||
|
|
5
server/build_android.sh
Executable file
5
server/build_android.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
export NDK_DIR="/home/johannes/Develop/android-toolchain-arm-14"
|
||||||
|
export ADD_CFLAGS=""
|
||||||
|
make clean; make TARGET=ANDROID -j 3; cp ./snapserver ../android/Snapcast/src/main/assets/bin/armeabi/
|
||||||
|
export ADD_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
|
||||||
|
make clean; make TARGET=ANDROID -j 3; cp ./snapserver ../android/Snapcast/src/main/assets/bin/armeabi-v7a/
|
|
@ -21,7 +21,9 @@
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "popl.hpp"
|
#include "popl.hpp"
|
||||||
|
#ifdef HAS_DAEMON
|
||||||
#include "common/daemon.h"
|
#include "common/daemon.h"
|
||||||
|
#endif
|
||||||
#include "common/timeDefs.h"
|
#include "common/timeDefs.h"
|
||||||
#include "common/signalHandler.h"
|
#include "common/signalHandler.h"
|
||||||
#include "common/snapException.h"
|
#include "common/snapException.h"
|
||||||
|
@ -77,7 +79,10 @@ int main(int argc, char* argv[])
|
||||||
.add(codecValue)
|
.add(codecValue)
|
||||||
.add(streamBufferValue)
|
.add(streamBufferValue)
|
||||||
.add(bufferValue)
|
.add(bufferValue)
|
||||||
.add(daemonOption);
|
#ifdef HAS_DAEMON
|
||||||
|
.add(daemonOption)
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -138,6 +143,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (daemonOption.isSet())
|
if (daemonOption.isSet())
|
||||||
{
|
{
|
||||||
|
#ifdef HAS_DAEMON
|
||||||
daemonize("/var/run/snapserver.pid");
|
daemonize("/var/run/snapserver.pid");
|
||||||
if (processPriority < -20)
|
if (processPriority < -20)
|
||||||
processPriority = -20;
|
processPriority = -20;
|
||||||
|
@ -146,6 +152,7 @@ int main(int argc, char* argv[])
|
||||||
if (processPriority != 0)
|
if (processPriority != 0)
|
||||||
setpriority(PRIO_PROCESS, 0, processPriority);
|
setpriority(PRIO_PROCESS, 0, processPriority);
|
||||||
logS(kLogNotice) << "daemon started" << std::endl;
|
logS(kLogNotice) << "daemon started" << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(HAS_AVAHI) || defined(HAS_BONJOUR)
|
#if defined(HAS_AVAHI) || defined(HAS_BONJOUR)
|
||||||
PublishZeroConf publishZeroConfg("Snapcast");
|
PublishZeroConf publishZeroConfg("Snapcast");
|
||||||
|
@ -180,7 +187,9 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
logS(kLogNotice) << "daemon terminated." << endl;
|
logS(kLogNotice) << "daemon terminated." << endl;
|
||||||
|
#ifdef HAS_DAEMON
|
||||||
daemonShutdown();
|
daemonShutdown();
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue