new package: libtsduck

This commit is contained in:
Tee KOBAYASHI 2022-02-13 00:45:51 +09:00 committed by xtkoba
parent 854633d041
commit 4c7fa89bb8
13 changed files with 215 additions and 0 deletions

View File

@ -0,0 +1,48 @@
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -164,9 +164,9 @@
# Enforce English locale by default in all commands for predictible output.
-export LANGUAGE = en_US.UTF-8
-export LC_ALL = en_US.UTF-8
-export LANG = en_US.UTF-8
+export LANGUAGE = C.UTF-8
+export LC_ALL = C.UTF-8
+export LANG = C.UTF-8
# Operating system, architecture, host name.
@@ -212,12 +212,12 @@
$(if $(LINUXBREW),$(if $(HOMEBREW_PREFIX),,$(error LINUXBREW is defined but not HOMEBREW_PREFIX)))
ALTDEVROOT := $(if $(HOMEBREW_PREFIX),$(HOMEBREW_PREFIX),$(if $(wildcard /opt/homebrew/bin),/opt/homebrew,/usr/local))
else
- ALTDEVROOT := /usr
+ ALTDEVROOT := @TERMUX_PREFIX@
endif
# Locate system directories.
-USELIB64 := $(if $(findstring linux-x86_64,$(LOCAL_OS)-$(MAIN_ARCH)),$(if $(LINUXBREW),,$(if $(wildcard /usr/lib64/libc.so*),true)))
+USELIB64 :=
SYSPREFIX ?= $(if $(MACOS)$(LINUXBREW),$(ALTDEVROOT),/usr)
USRLIBDIR ?= $(if $(USELIB64),$(SYSPREFIX)/lib64,$(SYSPREFIX)/lib)
ETCDIR ?= $(if $(subst /usr,,$(SYSPREFIX)),$(SYSPREFIX)/etc,/etc)
@@ -399,7 +399,7 @@
# Always use maximal or even paranoid warning mode.
# With clang, the option -Weverything turns everything on. There is no such option with GCC.
-CXXFLAGS_WARNINGS = -Werror
+CXXFLAGS_WARNINGS =
ifneq ($(USE_LLVM),)
CXXFLAGS_WARNINGS += -Weverything -Wno-c++98-compat-pedantic
ifneq ($(MACOS),)
@@ -468,7 +468,7 @@
# External libraries
-LDLIBS += -lstdc++ -lpthread $(if $(MACOS),,-lrt) -lm
+LDLIBS += -lm
# Global compilation flags.
# Additional flags can be passed on the "make" command line using xxFLAGS_EXTRA.

View File

@ -0,0 +1,53 @@
TERMUX_PKG_HOMEPAGE=https://tsduck.io/
TERMUX_PKG_DESCRIPTION="An extensible toolkit for MPEG transport streams"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_MAINTAINER="@termux"
_VERSION=3.29-2651
TERMUX_PKG_VERSION=${_VERSION//-/.}
TERMUX_PKG_SRCURL=https://github.com/tsduck/tsduck/archive/refs/tags/v${_VERSION}.tar.gz
TERMUX_PKG_SHA256=cab8f5838993aa1abd1a6a4c2ef7f2afba801da02a4001904f3f5ba5c5fe85a0
TERMUX_PKG_DEPENDS="libandroid-glob, libcurl, libedit"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="
SYSPREFIX=$TERMUX_PREFIX
CROSS_TARGET=$TERMUX_ARCH
CROSS=1
NOTEST=1
NODEKTEC=1
NOCURL=
NOPCSC=1
NOSRT=1
NORIST=1
NOEDITLINE=
NOTELETEXT=1
NOGITHUB=1
"
TERMUX_PKG_RM_AFTER_INSTALL="etc/security etc/udev"
termux_step_pre_configure() {
local bin="$TERMUX_PKG_BUILDDIR/_wrapper/bin"
local sh="$(command -v sh)"
mkdir -p "$bin"
for p in curl; do
local conf="$bin/${p}-config"
cat > "$conf" <<-EOF
#!${sh}
exec sh "$TERMUX_PREFIX/bin/${p}-config" "\$@"
EOF
chmod 0700 "$conf"
done
export PATH="$bin":$PATH
CXXFLAGS+=" -fno-strict-aliasing"
LDFLAGS+=" -landroid-glob"
}
termux_step_make() {
make -j $TERMUX_MAKE_PROCESSES \
CXX="$CXX" \
GCC="$CC" \
LD="$LD" \
CXXFLAGS_CROSS="$CXXFLAGS $CPPFLAGS" \
LDFLAGS_CROSS="$LDFLAGS" \
${TERMUX_PKG_EXTRA_MAKE_ARGS}
}

View File

@ -0,0 +1,23 @@
--- a/src/libtsduck/Makefile
+++ b/src/libtsduck/Makefile
@@ -128,7 +128,7 @@
$(SHARED_LIBTSDUCK): $(OBJS)
@echo ' [DTAPI] $(if $(DTAPI_OBJECT),using $(DTAPI_OBJECT),no DTAPI available)'; \
echo ' [LD] $@'; \
- $(CXX) $(CXXFLAGS) $(SOFLAGS) $^ $(LIBTSDUCK_LDLIBS) $(LDLIBS_EXTRA) $(LDLIBS) -shared -o $@
+ $(CXX) $(CXXFLAGS) $(SOFLAGS) $(LDFLAGS) $^ $(LIBTSDUCK_LDLIBS) $(LDLIBS_EXTRA) $(LDLIBS) -shared -o $@
# The static library is build differently. There are four specific categories:
# tables, descriptors, charsets and plugins. These classes use self-registration
@@ -187,11 +187,8 @@
+@$(call F_RECURSE,config python java)
install-devel: $(STATIC_LIBTSDUCK) tsduck.h
- rm -rf $(SYSROOT)$(SYSPREFIX)/include/tsduck
install -d -m 755 $(SYSROOT)$(USRLIBDIR) $(SYSROOT)$(SYSPREFIX)/include/tsduck
install -m 644 $(STATIC_LIBTSDUCK) $(SYSROOT)$(USRLIBDIR)
install -m 644 $(addsuffix /*.h,$(PUBLIC_INCLUDES)) $(SYSROOT)$(SYSPREFIX)/include/tsduck
- $(if $(NOTELETEXT),rm -f $(SYSROOT)$(SYSPREFIX)/include/tsduck/tsTeletextDemux.h)
- $(if $(NOTELETEXT),rm -f $(SYSROOT)$(SYSPREFIX)/include/tsduck/tsTeletextPlugin.h)
$(if $(NOTELETEXT),$(SED) -i -e '/TeletextDemux/d' -e '/TeletextPlugin/d' $(SYSROOT)$(SYSPREFIX)/include/tsduck/tsduck.h)
+@$(call F_RECURSE,config python java)

View File

@ -0,0 +1,11 @@
--- a/src/libtsduck/base/system/tsForkPipe.cpp
+++ b/src/libtsduck/base/system/tsForkPipe.cpp
@@ -451,7 +451,7 @@
// Execute the command if there was no prior error.
if (message == nullptr) {
- ::execl("/bin/sh", "/bin/sh", "-c", command.toUTF8().c_str(), nullptr);
+ ::execl("@TERMUX_PREFIX@/bin/sh", "@TERMUX_PREFIX@/bin/sh", "-c", command.toUTF8().c_str(), nullptr);
// Should not return, so this is an error if we get there.
error = errno;
message = "exec error";

View File

@ -0,0 +1,25 @@
--- a/src/libtsduck/base/system/tsThread.cpp
+++ b/src/libtsduck/base/system/tsThread.cpp
@@ -114,7 +114,7 @@
{
#if defined(TS_WINDOWS)
::SwitchToThread();
-#elif defined(TS_MAC) || defined(_GLIBCXX_USE_SCHED_YIELD)
+#elif defined(TS_MAC) || defined(_GLIBCXX_USE_SCHED_YIELD) || defined(__ANDROID__)
::sched_yield();
#else
::pthread_yield();
@@ -254,11 +254,13 @@
return false;
}
+#if !defined __ANDROID__ || __ANDROID_API__ >= 28
// Use explicit scheduling attributes, do not inherit them from the current thread.
if (::pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) {
::pthread_attr_destroy(&attr);
return false;
}
+#endif
// Create the thread
if (::pthread_create(&_pthread, &attr, Thread::ThreadProc, this) != 0) {

View File

@ -0,0 +1,16 @@
--- a/src/libtsduck/base/types/tsPlatform.h
+++ b/src/libtsduck/base/types/tsPlatform.h
@@ -1356,9 +1356,13 @@
#else
// Extract the type of the second parameter of ::ioctl().
// It is "unsigned long" on most Linux systems but "int" on Alpine Linux.
+#ifndef __ANDROID__
template<typename T>
T request_param_type(int (*ioctl_syscall)(int, T, ...));
typedef decltype(request_param_type(&::ioctl)) ioctl_request_t;
+#else
+ typedef int ioctl_request_t;
+#endif
#endif
}

View File

@ -0,0 +1,10 @@
--- a/src/libtsduck/python/Makefile
+++ b/src/libtsduck/python/Makefile
@@ -42,7 +42,6 @@
install: install-tools install-devel
install-tools:
- rm -rf $(SYSROOT)$(SYSPREFIX)/share/tsduck/python
install -d -m 755 $(SYSROOT)$(SYSPREFIX)/share/tsduck/python
install -m 644 tsduck.py ts.py $(SYSROOT)$(SYSPREFIX)/share/tsduck/python
install-devel:

View File

@ -0,0 +1,10 @@
--- a/src/tsplugins/Makefile
+++ b/src/tsplugins/Makefile
@@ -48,7 +48,6 @@
install: install-tools install-devel
install-tools: $(SHLIBS)
install -d -m 755 $(SYSROOT)$(USRLIBDIR)/tsduck
- $(if $(NO_TSPLUGINS),rm -rf $(addsuffix $(SO_SUFFIX),$(addprefix $(SYSROOT)$(USRLIBDIR)/tsduck/,$(NO_TSPLUGINS)),))
$(if $(MACOS),rm -rf $(SYSROOT)$(USRLIBDIR)/tsduck/*.so,)
install -m 644 $(SHLIBS) $(SYSROOT)$(USRLIBDIR)/tsduck
install-devel:

View File

@ -0,0 +1,9 @@
--- a/src/tstools/Makefile
+++ b/src/tstools/Makefile
@@ -63,6 +63,5 @@
install -m 755 $(EXECS) $(SYSROOT)$(SYSPREFIX)/bin
install -m 644 tsduck-completion.bash $(SYSROOT)$(BASHCOMP_DIR)/$(if $(BASHCOMP_AUTO),_tsduck,tsduck)
$(if $(BASHCOMP_AUTO),for cmd in $(ALLTOOLS); do ln -sf _tsduck $(SYSROOT)$(BASHCOMP_DIR)/$$cmd; done)
- $(if $(NO_TSTOOLS),rm -rf $(addprefix $(SYSROOT)$(SYSPREFIX)/bin/,$(NO_TSTOOLS)))
install-devel:
@true

View File

@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="share/tsduck/java/"
TERMUX_SUBPKG_DESCRIPTION="Java bindings for TSDuck"
TERMUX_SUBPKG_DEPENDS="openjdk-17"

View File

@ -0,0 +1,2 @@
TERMUX_SUBPKG_INCLUDE="lib/tsduck/"
TERMUX_SUBPKG_DESCRIPTION="Plugins for TSDuck"

View File

@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="share/tsduck/python/"
TERMUX_SUBPKG_DESCRIPTION="Python bindings for TSDuck"
TERMUX_SUBPKG_DEPENDS="python"

View File

@ -0,0 +1,2 @@
TERMUX_SUBPKG_INCLUDE="bin/ share/bash-completion/"
TERMUX_SUBPKG_DESCRIPTION="Command line tools for TSDuck"