~alpine/aports

[alpine-aports] [PATCH] testing/motion: Updated to version 4.0.1 with ffmpeg

Details
Message ID
<20170831091432.19371-1-kinsamanka@gmail.com>
Sender timestamp
1504170872
DKIM signature
missing
Download raw message
Patch: +143 -295
	- updated to the latest release
	- re-enabled ffmpeg support
	- switched to openrc init
	- used /var/lib/motion for storage
---
 testing/motion/APKBUILD                   |  53 ++++-----
 testing/motion/get_current_dir_name.patch |  46 --------
 testing/motion/motion-dist.conf.in.patch  | 184 +++++++++---------------------
 testing/motion/motion.confd               |  22 ++--
 testing/motion/motion.initd               |  44 ++++---
 testing/motion/motion.pre-install         |   2 +-
 testing/motion/pthread.patch              |  23 ++++
 testing/motion/pthread_key_create.patch   |  53 ---------
 testing/motion/strerror_r.patch           |  11 ++
 9 files changed, 143 insertions(+), 295 deletions(-)
 delete mode 100644 testing/motion/get_current_dir_name.patch
 create mode 100644 testing/motion/pthread.patch
 delete mode 100644 testing/motion/pthread_key_create.patch
 create mode 100644 testing/motion/strerror_r.patch

diff --git a/testing/motion/APKBUILD b/testing/motion/APKBUILD
index 691531f..596c534 100644
--- a/testing/motion/APKBUILD
+++ b/testing/motion/APKBUILD
@@ -2,28 +2,29 @@
# Contributor: Mika Havela <mika.havela@gmail.com>
# Maintainer: Mika Havela <mika.havela@gmail.com>
pkgname=motion
pkgver=3.2.12
pkgrel=3
pkgver=4.0.1
pkgrel=0
pkgdesc="Detect if a significant part of the picture has changed (e.g. from a webcam)."
url="http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome"
url="https://motion-project.github.io"
arch="all"
options="!check"
license="GPL2"
pkgusers="motion"
pkggroups="motion"
depends="jpeg v4l-utils"   # Add ffmpeg (when motion is patched/fixed for this)
depends="jpeg v4l-utils ffmpeg"
depends_dev=""
makedepends="$depends_dev bash jpeg-dev v4l-utils-dev linux-headers"  # Add ffmpeg-dev (when motion is patched/fixed for this)
makedepends="$depends_dev autoconf automake bash jpeg-dev v4l-utils-dev linux-headers ffmpeg-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
source="$pkgname-$pkgver.tar.gz::https://github.com/Motion-Project/$pkgname/archive/release-$pkgver.tar.gz
	motion.confd
	motion.initd
	motion-dist.conf.in.patch
	pthread_key_create.patch
	get_current_dir_name.patch
	pthread.patch
	strerror_r.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
_builddir="$srcdir"/$pkgname-release-$pkgver
prepare() {
	local i
	cd "$_builddir"
@@ -37,11 +38,13 @@ prepare() {

build() {
	cd "$_builddir"
	autoreconf -fiv
	./configure \
	--without-pgsql \
	--without-mysql \
	--without-sqlite3 \
	--prefix=/usr \
	--sysconfdir=/etc/motion \
	--without-ffmpeg \

	--sysconfdir=/etc

	make || return 1
}
@@ -50,27 +53,15 @@ package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	install -d -o "$pkgusers" -g "$pkggroups" "$pkgdir"/var/run/motion
	install -d -o "$pkgusers" -g "$pkggroups" "$pkgdir"/home/motion/motion_captures    # Default config is configured to store captures here
	install -d -o "$pkgusers" -g "$pkggroups" "$pkgdir"/var/lib/motion    # Default config is configured to store captures here
	install -Dm644 "$srcdir"/"$pkgname".confd "$pkgdir"/etc/conf.d/"$pkgname"
	install -Dm755 "$srcdir"/"$pkgname".initd "$pkgdir"/etc/init.d/"$pkgname"
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

md5sums="1ba0065ed50509aaffb171594c689f46  motion-3.2.12.tar.gz
c444bfd48ac8d6272d5191836ceb544a  motion.confd
3acfe162df3fec28c88c1688e7385189  motion.initd
2ee4fa214987e7643025732f016e9296  motion-dist.conf.in.patch
1eca97b280069ad0f1d5cb9946145907  pthread_key_create.patch
bd58201a2d4724457b668fb65f7b17c3  get_current_dir_name.patch"
sha256sums="a597f8d7ec0bf3c5fb62722c4eead59717fe01c2ae0d256c642027cea74b2f0a  motion-3.2.12.tar.gz
a89d6b9b070d9447694a3acb9c20768bf232ff37d45728aee7f972f5a0a2b855  motion.confd
f65843332b1d342058fcb96f139d2334105a009af10692f4dd619d4ccf63eb85  motion.initd
f164f1c290734378823559bb3f643316f8da8eb61d6fe720761ad4f369a6a074  motion-dist.conf.in.patch
7658950a54363b8aa8090c508f3864f2e15af9def10bdc96f18cdac7cb141ef0  pthread_key_create.patch
8cdf811aa274f08c02bd0b3e67548d337f1472d1a9c041c129deeb15ab74fa7d  get_current_dir_name.patch"
sha512sums="d44620f8865420da71ff1dc1e1d8ba8e5465b395f2cf3b2cc9a91d3d415694b26376a9f8e3a1b78ffd0efde22d9e0338daa77237aed38c060dc3577af4c0864c  motion-3.2.12.tar.gz
37821907f3b974675be2584460f499e83c3745ee70fa4674e82186fa9f9c04346e3d4a83a0eb3133bdb33ecee169bf590f6d3eda45ef54958f8babdce446ea08  motion.confd
a589e56929a5091c1e398f81b9f1744f393006b429a27e5b7227326e3afc4dd792e30486d66f608208eec18e7062e14f673493aafd55a5fed9d33d160bc723a0  motion.initd
f45fb8f95b7b336b72acf04b29f30413fae1d247d3ad430c36862475ce3148e210d3feb390dc898a369470da20c16c2d26fd018dcb9a7cfe1e4e9c95a46d0f75  motion-dist.conf.in.patch
17da7b1d2c15b5f95246e8c8f88ff82c090110a950f41d02c55840265d46b8838511602f4da489c16b0e31a1b346345a208994b529064771a37e436ad49650e9  pthread_key_create.patch
c1d11dd378673f85db290a1d181b7aa454baac7d6ed77a46cdc24cc83c1fc708bafbd76d851767256b797dae4d2032efecbd6e66ffe532b8fda61d2d920b7d58  get_current_dir_name.patch"
sha512sums="6ccde3890e6af56f28208321987dd1b9d62a55bbe7cbc3ab5600263602e6e8f47589392c2f3a3a6cb54f927ee76aea94d0e83f26ce8e4047890c891b6c2f8976  motion-4.0.1.tar.gz
8a67b5b0360924e58ba3136a737ce73bb43201a49b2b6e2c632426561b830f6ab55cbbeaa89be7f1683aa8fd322b4f31b9f560e67a93eaceb964c9f56ceef363  motion.confd
be30f19595dba27f2d0ca8133c93e134161781935a152bd1701e581410039e37742acd11987c38e6e64f495b1fd2b0a74a8c61ae0e6e211a475fca7994172501  motion.initd
2ac312c7bdd6a487b875a0b39c69a9e61a8d0767f6834be3598242d2f607e823920ad379c5bf10afe2d90de25a1ab03b6d745f18ba952181dad5a154b761388f  motion-dist.conf.in.patch
aab20c38dc57f5ad5f4a4a96220a69589208138401b42c181ab0cb8aa8238d5441b50af40c7bc481729cc74247aa3d2923633b06957817bbaa9282c9d6a24b8d  pthread.patch
a94ea4512c1b53fce38791a7773d01021092009afdac68552aad72749f7b9a18804a78adcf00f2810753f37b40617c5f4111711338369b28d2ddd63b268a0782  strerror_r.patch"
diff --git a/testing/motion/get_current_dir_name.patch b/testing/motion/get_current_dir_name.patch
deleted file mode 100644
index d7e3816..0000000
--- a/testing/motion/get_current_dir_name.patch
@@ -1,46 +0,0 @@
The check for get_current_dir_name appears to be broken. you need
set _GNU_SOURCE for it.

But that triggered other issue with broken ifdefs so we simply avoid
using get_current_dir_name alltogether.

--- ./conf.c.orig
+++ ./conf.c
@@ -32,16 +32,6 @@
 #include "video.h"
 #endif /* BSD */
 
-#ifndef HAVE_GET_CURRENT_DIR_NAME
-char *get_current_dir_name(void)
-{
-    char *buf = malloc(MAXPATHLEN);
-    getwd(buf);
-    return buf;
-}
-#endif
--
--
 #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0;}
 
 
@@ -1645,18 +1635,17 @@
     }
 
     if (!fp) {      /* Commandline didn't work, try current dir */
-        char *path = NULL;
+        char path[PATH_MAX];
         if (cnt[0]->conf_filename[0])
             motion_log(-1, 1, "Configfile %s not found - trying defaults.", filename);
         
-        if ((path = get_current_dir_name()) == NULL) {
+        if (getcwd(path, PATH_MAX) == NULL) {
             motion_log(LOG_ERR, 1, "Error get_current_dir_name");
             exit(-1);
         }
 
         snprintf(filename, PATH_MAX, "%s/motion.conf", path);
         fp = fopen (filename, "r");
-        free(path);
     }
 
     if (!fp) {     /* specified file does not exist... try default file */
diff --git a/testing/motion/motion-dist.conf.in.patch b/testing/motion/motion-dist.conf.in.patch
index 9d6d82d..0fddba9 100644
--- a/testing/motion/motion-dist.conf.in.patch
+++ b/testing/motion/motion-dist.conf.in.patch
@@ -1,124 +1,43 @@
--- motion-3.2.12/motion-dist.conf.in
--- motion-4.0.1/motion-dist.conf.in
+++ ./motion-dist.conf.in
@@ -1,6 +1,6 @@
 # Rename this distribution example file to motion.conf
 #
-# This config file was generated by @PACKAGE_NAME@ @PACKAGE_VERSION@
+# This config file was generated by motion 3.2.12
 
 
+# This config file was generated by motion 4.0.1


 ############################################################
@@ -237,57 +237,6 @@
 
 
 ############################################################
-# FFMPEG related options
-# Film (mpeg) file output, and deinterlacing of the video input
-# The options movie_filename and timelapse_filename are also used
-# by the ffmpeg feature
-############################################################
--
-# Use ffmpeg to encode mpeg movies in realtime (default: off)
-ffmpeg_cap_new on
--
-# Use ffmpeg to make movies with only the pixels moving
-# object (ghost images) (default: off)
-ffmpeg_cap_motion off
--
-# Use ffmpeg to encode a timelapse movie 
-# Default value 0 = off - else save frame every Nth second
-ffmpeg_timelapse 0
--
-# The file rollover mode of the timelapse video
-# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual
-ffmpeg_timelapse_mode daily
--
-# Bitrate to be used by the ffmpeg encoder (default: 400000)
-# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled)
-ffmpeg_bps 500000
--
-# Enables and defines variable bitrate for the ffmpeg encoder.
-# ffmpeg_bps is ignored if variable bitrate is enabled.
-# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps,
-# or the range 2 - 31 where 2 means best quality and 31 is worst.
-ffmpeg_variable_bitrate 0
--
-# Codec to used by ffmpeg for the video compression.
-# Timelapse mpegs are always made in mpeg1 format independent from this option.
-# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.
-# mpeg1 - gives you files with extension .mpg
-# mpeg4 or msmpeg4 - gives you files with extension .avi
-# msmpeg4 is recommended for use with Windows Media Player because
-# it requires no installation of codec on the Windows client.
-# swf - gives you a flash film with extension .swf
-# flv - gives you a flash video with extension .flv
-# ffv1 - FF video codec 1 for Lossless Encoding ( experimental )
-# mov - QuickTime ( testing )
-ffmpeg_video_codec mpeg4
--
-# Use ffmpeg to deinterlace video. Necessary if you use an analog camera
-# and see horizontal combing on moving objects in video or pictures.
-# (default: off)
-ffmpeg_deinterlace off
--
--
-############################################################
 # Snapshots (Traditional Periodic Webcam File Output)
 ############################################################
 
@@ -356,7 +305,7 @@
 
@@ -447,7 +447,7 @@

 # Target base directory for pictures and films
 # Recommended to use absolute path. (Default: current working directory)
-target_dir /usr/local/apache2/htdocs/cam1
+target_dir /home/motion/motion_captures
 
-#target_dir /tmp/motion
+target_dir /var/lib/motion

 # File path for snapshots (jpeg or ppm) relative to target_dir
 # Default: %v-%Y%m%d%H%M%S-snapshot
@@ -376,22 +325,7 @@
 # convention for preview shots. See motion guide for details
 jpeg_filename %v-%Y%m%d%H%M%S-%q
 
-# File path for motion triggered ffmpeg films (mpeg) relative to target_dir
-# Default: %v-%Y%m%d%H%M%S
-# Default value is equivalent to legacy oldlayout option
-# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S
-# File extension .mpg or .avi is automatically added so do not include this
-# This option was previously called ffmpeg_filename
-movie_filename %v-%Y%m%d%H%M%S
 
-# File path for timelapse mpegs relative to target_dir
-# Default: %Y%m%d-timelapse
-# Default value is near equivalent to legacy oldlayout option
-# For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse
-# File extension .mpg is automatically added so do not include this
-timelapse_filename %Y%m%d-timelapse
--
--
 ############################################################
 # Live Webcam Server
 ############################################################
@@ -540,69 +474,6 @@
 # It depends on the driver, some drivers don't detect a lost camera at all
 # Some hang the motion thread. Some even hang the PC! (default: none)
@@ -666,70 +666,6 @@
 # It depends on the driver, some drivers dosn't detect a lost camera at all
 # Some hangs the motion thread. Some even hangs the PC! (default: none)
 ; on_camera_lost value
-
-############################################################
-# Common Options For MySQL and PostgreSQL database features.
-# Options require the MySQL/PostgreSQL options to be active also.
-############################################################
-#####################################################################
-# Common Options for database features.
-# Options require database options to be active also.
-#####################################################################
-
-# Log to the database when creating motion triggered image file  (default: on)
-sql_log_image on
-# Log to the database when creating motion triggered picture file  (default: on)
-; sql_log_picture on
-
-# Log to the database when creating a snapshot image file (default: on)
-sql_log_snapshot on
-; sql_log_snapshot on
-
-# Log to the database when creating motion triggered mpeg file (default: off)
-sql_log_mpeg off
-# Log to the database when creating motion triggered movie file (default: off)
-; sql_log_movie off
-
-# Log to the database when creating timelapse mpeg file (default: off)
-sql_log_timelapse off
-# Log to the database when creating timelapse movies file (default: off)
-; sql_log_timelapse off
-
-# SQL query string that is sent to the database
-# Use same conversion specifiers has for text features
@@ -126,45 +45,46 @@
-# %n = the number representing the file_type
-# %f = filename with full path
-# Default value:
-# Create tables :
-##
-# Mysql
-# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14));
-#
-# Postgresql
-# CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp without time zone, event_time_stamp timestamp without time zone);
-#
-# insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
-sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
-; sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
-
-
-############################################################
-# Database Options For MySQL
-# Database Options
-############################################################
-
-# Mysql database to log to (default: not defined)
-; mysql_db value
--
-# The host on which the database is located (default: localhost)
-; mysql_host value
--
-# User account name for MySQL database (default: not defined)
-; mysql_user value
-# database type : mysql, postgresql, sqlite3 (default : not defined)
-; database_type value
-
-# User password for MySQL database (default: not defined)
-; mysql_password value
-# database to log to (default: not defined)
-# for sqlite3, the full path and name for the database.
-; database_dbname value
-
-# The host on which the database is located (default: localhost)
-; database_host value
-
-############################################################
-# Database Options For PostgreSQL
-############################################################
--
-# PostgreSQL database to log to (default: not defined)
-; pgsql_db value
-# User account name for database (default: not defined)
-; database_user value
-
-# The host on which the database is located (default: localhost)
-; pgsql_host value
-# User password for database (default: not defined)
-; database_password value
-
-# User account name for PostgreSQL database (default: not defined)
-; pgsql_user value
-# Port on which the database is located
-#  mysql 3306 , postgresql 5432 (default: not defined)
-; database_port value
-
-# User password for PostgreSQL database (default: not defined)
-; pgsql_password value
-# Database wait time in milliseconds for locked database to
-# be unlocked before returning database locked error (default 0)
-; database_busy_timeout 0
-
-# Port on which the PostgreSQL database is located (default: 5432)
-; pgsql_port 5432
 
 


 ############################################################
diff --git a/testing/motion/motion.confd b/testing/motion/motion.confd
index ff24e5c..dfff31b 100644
--- a/testing/motion/motion.confd
+++ b/testing/motion/motion.confd
@@ -1,17 +1,9 @@
# /etc/conf.d/motion
## -c     Full path and filename of config file. E.g. /home/kurt/motion.conf. 
##        Default is /usr/local/etc unless specified differently when building 
##        Motion. Many RPMs and debian packages will most likely use /etc or 
##        /etc/motion as default.
##
## -n     Run in non-daemon mode.
##
## -s     Run in setup mode. Also forces non-daemon mode
##
## -d level Run in debug mode, level 1-9.
##
##
## See the motion(1) manpage for more info.
# Set the user and group under which motion will be run
MOTION_USER="motion"
MOTION_GROUP="video"

MOTION_OPTS="-c /etc/motion/motion-dist.conf"
# Set the the directory for storing the pidfile
MOTION_RUN_DIR="/var/run/motion"

# Set the the working directory for storing images/videos
MOTION_LIB_DIR="/var/lib/motion"
diff --git a/testing/motion/motion.initd b/testing/motion/motion.initd
index 78493c3..b475576 100644
--- a/testing/motion/motion.initd
+++ b/testing/motion/motion.initd
@@ -1,27 +1,37 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.init.d,v 1.5 2007/02/23 11:33:59 uberlord Exp $

description="motion daemon"
user="motion"
command="/usr/bin/motion"
pidfile="/var/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"
extra_started_commands="reload"

checkconfig() {
	export MOTION_RUN_DIR="${MOTION_RUN_DIR:-/var/run/motion}"
	checkpath -d -m 750 -o "${MOTION_USER:-motion}:${MOTION_GROUP:-video}" "${MOTION_RUN_DIR}"
	export MOTION_LIB_DIR="${MOTION_LIB_DIR:-/var/lib/motion}"
	checkpath -d -m 750 -o "${MOTION_USER:-motion}:${MOTION_GROUP:-video}" "${MOTION_LIB_DIR}"
	return 0
}

start() {
	ebegin "Starting ${RC_SVCNAME}"
	start-stop-daemon --start \
	    --exec ${command} \
	    --user ${user} \
	    --pidfile ${pidfile} \
	    -- ${MOTION_OPTS}
	checkconfig || return 1

	ebegin "Starting motion detection"
	start-stop-daemon --start -u "${MOTION_USER}" -g "${MOTION_GROUP}" -d "${MOTION_LIB_DIR}" --quiet --exec /usr/bin/motion -- -b -p "${MOTION_RUN_DIR}/motion.pid"
	eend $?
}

stop() {
	ebegin "Stopping ${RC_SVCNAME}"
	start-stop-daemon --stop \
	    --exec ${command} \
	    --pidfile ${pidfile}
	checkconfig || return 1

	ebegin "Stopping motion detection"
	start-stop-daemon --stop --quiet --exec /usr/bin/motion --pidfile "${MOTION_RUN_DIR}/motion.pid"
	eend $?
}

reload() {
	checkconfig || return 1

	ebegin "Reloading motion detection configuration"
	start-stop-daemon --stop --signal HUP --exec /usr/bin/motion --pidfile "${MOTION_RUN_DIR}/motion.pid"
	eend $?
}
diff --git a/testing/motion/motion.pre-install b/testing/motion/motion.pre-install
index de22bc1..f18364e 100644
--- a/testing/motion/motion.pre-install
+++ b/testing/motion/motion.pre-install
@@ -1,7 +1,7 @@
#!/bin/sh

addgroup -S motion 2>/dev/null
adduser -S -D -h /home/motion -s /bin/false -G motion -g motion motion 2>/dev/null
adduser -S -D -h /var/lib/motion -s /bin/false -G motion -g motion motion 2>/dev/null
addgroup motion video 2>/dev/null

exit 0
diff --git a/testing/motion/pthread.patch b/testing/motion/pthread.patch
new file mode 100644
index 0000000..5708497
--- /dev/null
+++ b/testing/motion/pthread.patch
@@ -0,0 +1,23 @@
configure doesn't generate proper pthread support

--- motion-4.0.1/configure.ac
+++ ./configure.ac
@@ -188,7 +188,8 @@
  pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
  [PTHREAD_LIB=yes])

-if test x$PTHREAD_LIB != xyes; then
+# this test should fail but it doesn't on alpine
+if test x$PTHREAD_LIB = xyes; then

 	if test "${FreeBSD}" != ""; then
 		TEMP_LIBS="$TEMP_LIBS -pthread"
@@ -213,7 +214,7 @@
     CFLAGS="$TEMP_CFLAGS"
     LIBS="$TEMP_LIBS"
     AC_LINK_IFELSE(
-    [AC_LANG_PROGRAM([[#include <pthread.h>]], [[  pthread_setname_np(pthread_self(), "name")]])],
+    [AC_LANG_PROGRAM([[#include <pthread.h>]], [[  pthread_getname_np(pthread_self(), "name", 0)]])],
     [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.])
      AC_MSG_RESULT([[yes]])],
     [AC_MSG_RESULT([[no]])] )
diff --git a/testing/motion/pthread_key_create.patch b/testing/motion/pthread_key_create.patch
deleted file mode 100644
index afedce7..0000000
--- a/testing/motion/pthread_key_create.patch
@@ -1,53 +0,0 @@
make sure we create the tls key before we access in any way.

we also fix the check for broken glibc strerror_r

--- ./motion.c.orig
+++ ./motion.c
@@ -2267,6 +2267,9 @@
     struct sigaction sigchild_action;
     setup_signals(&sig_handler_action, &sigchild_action);
 
+    /* Create the TLS key for thread number. */
+    pthread_key_create(&tls_key_threadnr, NULL);
+
     motion_startup(1, argc, argv);
 
 #ifdef HAVE_FFMPEG
@@ -2290,9 +2293,6 @@
     pthread_attr_init(&thread_attr);
     pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
 
-    /* Create the TLS key for thread number. */
-    pthread_key_create(&tls_key_threadnr, NULL);
--
     do {
         if (restart) {
             /* Handle the restart situation. Currently the approach is to
@@ -2745,9 +2745,6 @@
 {
     int errno_save, n;
     char buf[1024];
-#if (!defined(BSD)) && (!(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
-    char msg_buf[100];
-#endif
     va_list ap;
     int threadnr;
 
@@ -2780,12 +2778,13 @@
          * version of strerror_r, which doesn't actually put the message into
          * my buffer :-(.  I have put in a 'hack' to get around this.
          */
-#if (defined(BSD))
-        strerror_r(errno_save, buf + n, sizeof(buf) - n);    /* 2 for the ': ' */
-#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
+#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! defined(_GNU_SOURCE))
         strerror_r(errno_save, buf + n, sizeof(buf) - n);
 #else
+	{
+        char msg_buf[100];
         strncat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf)), 1024 - strlen(buf));
+	}
 #endif
     }
     /* If 'level' is not negative, send the message to the syslog */
diff --git a/testing/motion/strerror_r.patch b/testing/motion/strerror_r.patch
new file mode 100644
index 0000000..bbe625e
--- /dev/null
+++ b/testing/motion/strerror_r.patch
@@ -0,0 +1,11 @@
--- motion-4.0.1/motion.h
+++ ./motion.h
@@ -88,7 +88,7 @@
 #endif

 /* strerror_r() XSI vs GNU */
-#if (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
+#if !defined(__GLIBC__) || (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
 #define XSI_STRERROR_R
 #endif

-- 
2.14.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)