snapper: unbreak musl
This commit is contained in:
parent
4fb6cd1b14
commit
3d9f05ffc6
9 changed files with 158 additions and 1 deletions
13
srcpkgs/snapper/patches/fix-poll_h.patch
Normal file
13
srcpkgs/snapper/patches/fix-poll_h.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
The correct location is <poll.h>, not <sys/poll.h>
|
||||||
|
|
||||||
|
--- snapper/SystemCmd.h 2014-02-05 14:22:06.000000000 +0100
|
||||||
|
+++ snapper/SystemCmd.h 2015-08-30 10:56:03.685179465 +0200
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
#ifndef SNAPPER_SYSTEM_CMD_H
|
||||||
|
#define SNAPPER_SYSTEM_CMD_H
|
||||||
|
|
||||||
|
-#include <sys/poll.h>
|
||||||
|
+#include <poll.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <string>
|
19
srcpkgs/snapper/patches/musl-__isleap.patch
Normal file
19
srcpkgs/snapper/patches/musl-__isleap.patch
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
The macro __isleap() is defined in glibc's time.h
|
||||||
|
If it is not defined, define it the same (for musl libc).
|
||||||
|
|
||||||
|
--- client/utils/equal-date.h 2014-12-11 18:21:17.000000000 +0100
|
||||||
|
+++ client/utils/equal-date.h 2015-08-30 11:18:08.181207315 +0200
|
||||||
|
@@ -19,6 +19,13 @@
|
||||||
|
* find current contact information at www.novell.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#if !defined(__isleap)
|
||||||
|
+/* Nonzero if YEAR is a leap year (every 4 years,
|
||||||
|
+ except every 100th isn't, and every 400th is). */
|
||||||
|
+# define __isleap(year) \
|
||||||
|
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
|
||||||
|
bool
|
||||||
|
equal_year(const struct tm& tmp1, const struct tm& tmp2);
|
51
srcpkgs/snapper/patches/musl-_nl_msg_cat_cntr.patch
Normal file
51
srcpkgs/snapper/patches/musl-_nl_msg_cat_cntr.patch
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
There is no _nl_msg_cat_cntr in musl libc and optimizations
|
||||||
|
based upon its unchanged value are not possible.
|
||||||
|
|
||||||
|
--- snapper/Regex.cc 2014-01-29 16:48:30.000000000 +0100
|
||||||
|
+++ snapper/Regex.cc 2015-08-30 11:07:34.613193993 +0200
|
||||||
|
@@ -22,7 +22,9 @@
|
||||||
|
|
||||||
|
#include "snapper/Regex.h"
|
||||||
|
|
||||||
|
+#if defined(__GLIBC__)
|
||||||
|
extern int _nl_msg_cat_cntr;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace snapper
|
||||||
|
@@ -34,7 +36,9 @@
|
||||||
|
nm (cflags & REG_NOSUB ? 0 : nm)
|
||||||
|
{
|
||||||
|
regcomp (&rx, pattern, cflags);
|
||||||
|
+#if defined(__GLIBC__)
|
||||||
|
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
|
||||||
|
+#endif
|
||||||
|
rm = new regmatch_t[nm];
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +49,9 @@
|
||||||
|
nm (cflags & REG_NOSUB ? 0 : nm)
|
||||||
|
{
|
||||||
|
regcomp (&rx, pattern.c_str (), cflags);
|
||||||
|
+#if defined(__GLIBC__)
|
||||||
|
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
|
||||||
|
+#endif
|
||||||
|
rm = new regmatch_t[nm];
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -60,11 +66,15 @@
|
||||||
|
bool
|
||||||
|
Regex::match (const string& str, int eflags) const
|
||||||
|
{
|
||||||
|
+#if defined(__GLIBC__)
|
||||||
|
if (my_nl_msg_cat_cntr != _nl_msg_cat_cntr) {
|
||||||
|
+#endif
|
||||||
|
regfree (&rx);
|
||||||
|
regcomp (&rx, pattern.c_str (), cflags);
|
||||||
|
+#if defined(__GLIBC__)
|
||||||
|
my_nl_msg_cat_cntr = _nl_msg_cat_cntr;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
last_str = str;
|
||||||
|
|
15
srcpkgs/snapper/patches/musl-mktime.patch
Normal file
15
srcpkgs/snapper/patches/musl-mktime.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
According to http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_21.html
|
||||||
|
timelocal(2) is functionally identical to mktime(2), but more
|
||||||
|
mnemonically named. There is no timelocal(2) defined in musl libc.
|
||||||
|
|
||||||
|
--- snapper/AppUtil.cc 2015-02-18 18:54:03.000000000 +0100
|
||||||
|
+++ snapper/AppUtil.cc 2015-08-30 10:39:31.318158599 +0200
|
||||||
|
@@ -274,7 +274,7 @@
|
||||||
|
const char* p = strptime(str.c_str(), "%F %T", &s);
|
||||||
|
if (!p || *p != '\0')
|
||||||
|
return (time_t)(-1);
|
||||||
|
- return utc ? timegm(&s) : timelocal(&s);
|
||||||
|
+ return utc ? timegm(&s) : mktime(&s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
12
srcpkgs/snapper/patches/musl-mode_t.patch
Normal file
12
srcpkgs/snapper/patches/musl-mode_t.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
The mode_t type is defined in fcntl.h
|
||||||
|
|
||||||
|
--- snapper/FileUtils.h 2015-02-18 18:54:03.000000000 +0100
|
||||||
|
+++ snapper/FileUtils.h 2015-08-30 10:45:43.285166420 +0200
|
||||||
|
@@ -24,6 +24,7 @@
|
||||||
|
#define SNAPPER_FILE_UTILS_H
|
||||||
|
|
||||||
|
|
||||||
|
+#include <fcntl.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <functional>
|
15
srcpkgs/snapper/patches/musl-stdout_stderr.patch
Normal file
15
srcpkgs/snapper/patches/musl-stdout_stderr.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
In musl libc stdout and stderr are macros, thus we need to
|
||||||
|
undefine them to be able to use SystemCmd::stdout() and ::stderr()
|
||||||
|
members without renaming them - which may be a better choice.
|
||||||
|
|
||||||
|
--- snapper/SystemCmd.h 2015-08-30 10:59:53.740184303 +0200
|
||||||
|
+++ snapper/SystemCmd.h 2015-08-30 11:02:34.229187677 +0200
|
||||||
|
@@ -31,6 +31,8 @@
|
||||||
|
#include <list>
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
|
+#undef stdout
|
||||||
|
+#undef stderr
|
||||||
|
|
||||||
|
namespace snapper
|
||||||
|
{
|
14
srcpkgs/snapper/patches/musl-strerror_r.patch
Normal file
14
srcpkgs/snapper/patches/musl-strerror_r.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
In musl libc the return type of strerror_r(2) is int (XSI-compliant).
|
||||||
|
We define MUSL_LIBC in CXXFLAGS to skip the wrong #else implementation.
|
||||||
|
|
||||||
|
--- snapper/AppUtil.cc 2015-08-30 15:34:51.106531190 +0200
|
||||||
|
+++ snapper/AppUtil.cc 2015-08-30 15:35:41.996532260 +0200
|
||||||
|
@@ -209,7 +209,7 @@
|
||||||
|
string
|
||||||
|
stringerror(int errnum)
|
||||||
|
{
|
||||||
|
-#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
|
||||||
|
+#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) || MUSL_LIBC
|
||||||
|
char buf1[100];
|
||||||
|
if (strerror_r(errno, buf1, sizeof(buf1)-1) == 0)
|
||||||
|
return string(buf1);
|
12
srcpkgs/snapper/patches/musl-unistd.h
Normal file
12
srcpkgs/snapper/patches/musl-unistd.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
Need to include unistd.h to define uid_t for musl libc.
|
||||||
|
|
||||||
|
--- snapper/Snapshot.h 2015-02-18 18:54:03.000000000 +0100
|
||||||
|
+++ snapper/Snapshot.h 2015-08-30 10:33:14.197150669 +0200
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'snapper'
|
# Template file for 'snapper'
|
||||||
pkgname=snapper
|
pkgname=snapper
|
||||||
version=0.2.8
|
version=0.2.8
|
||||||
revision=1
|
revision=2
|
||||||
lib32disabled=yes
|
lib32disabled=yes
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
configure_args="--disable-zypp --with-conf=/etc/conf.d --sbindir=/usr/bin"
|
configure_args="--disable-zypp --with-conf=/etc/conf.d --sbindir=/usr/bin"
|
||||||
|
@ -16,6 +16,12 @@ homepage="http://snapper.io"
|
||||||
distfiles="ftp://ftp.suse.com/pub/projects/$pkgname/$pkgname-$version.tar.bz2"
|
distfiles="ftp://ftp.suse.com/pub/projects/$pkgname/$pkgname-$version.tar.bz2"
|
||||||
checksum=a44608648ed21a1346f8ae9345044901c39ad01abb501806a22c9d4a771eadc5
|
checksum=a44608648ed21a1346f8ae9345044901c39ad01abb501806a22c9d4a771eadc5
|
||||||
|
|
||||||
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
|
*-musl) # We define MUSL_LIBC to pick the correct return type
|
||||||
|
# for strerror_r(2) which is int (XSI-compliant)
|
||||||
|
CXXFLAGS="-DMUSL_LIBC=1"
|
||||||
|
esac
|
||||||
|
|
||||||
pre_configure() {
|
pre_configure() {
|
||||||
# rename cron scripts
|
# rename cron scripts
|
||||||
sed -i -e 's@suse.de-@@g' scripts/Makefile.am
|
sed -i -e 's@suse.de-@@g' scripts/Makefile.am
|
||||||
|
|
Loading…
Reference in a new issue