Skip to content

Commit

Permalink
Implement Alpine Linux support with Dockerfile to boot
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelMarks committed Aug 2, 2024
1 parent 732e2d4 commit 4496ba9
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine
RUN apk add --no-cache bison cmake pkgconf python3 \
openssl-dev bzip2-dev lz4-dev pcre-dev readline-dev xz-dev zlib-dev \
build-base
WORKDIR /src/monetdb
COPY . .
RUN cmake -S . -B build && \
cmake --build build && \
cmake --install build --prefix /mybin
5 changes: 4 additions & 1 deletion common/stream/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,10 @@ my_strerror_r(int error_nr, char *buf, size_t buflen)
#ifndef HAVE_STRERROR_R
// Hope for the best
to_move = strerror(error_nr);
#elif !defined(_GNU_SOURCE) || !_GNU_SOURCE

#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L \
|| defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) && \
!_GNU_SOURCE || defined(__MUSL__)
// standard strerror_r always writes to buf
int result_code = strerror_r(error_nr, buf, buflen);
if (result_code == 0)
Expand Down
5 changes: 4 additions & 1 deletion gdk/gdk_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ gdk_export int strerror_r(int errnum, char *buf, size_t buflen);
static inline const char *
GDKstrerror(int errnum, char *buf, size_t buflen)
{
#if !defined(_GNU_SOURCE) || ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE)
#if !defined(_GNU_SOURCE) || ( \
(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
&& defined(_GNU_SOURCE) && !_GNU_SOURCE) \
|| defined(__MUSL__)
if (strerror_r(errnum, buf, buflen) == 0)
return buf;
snprintf(buf, buflen, "Unknown error %d", errnum);
Expand Down
15 changes: 15 additions & 0 deletions monetdb_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@
#define WIN32 1
#endif

/* MUSL detection */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <features.h>
#ifndef __USE_GNU
#define __MUSL__
#endif
#undef _GNU_SOURCE
#else
#include <features.h>
#ifndef __USE_GNU
#define __MUSL__
#endif
#endif

// Section: monetdb configure defines
#cmakedefine HAVE_DISPATCH_DISPATCH_H 1
#cmakedefine HAVE_DLFCN_H 1
Expand Down
8 changes: 8 additions & 0 deletions tools/merovingian/daemon/merovingian.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@
#define pipe2(pipefd, flags) pipe(pipefd)
#endif

#ifndef S_IRWXG
#define S_IRWXG 0070
#endif

#ifndef S_IRWXO
#define S_IRWXO 0007
#endif

/* private structs */

typedef struct _threadlist {
Expand Down
4 changes: 4 additions & 0 deletions tools/merovingian/daemon/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __MUSL__
#include <fcntl.h>
#else
#include <sys/fcntl.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
Expand Down

0 comments on commit 4496ba9

Please sign in to comment.