aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-10-21 11:10:39 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-10-21 11:22:50 +0300
commit73a97f8c926a19e65e72d70448ffa34b7281f1bd (patch)
tree533c635ff4f07a8c5a16c5822637ec63fca78a0e /contrib
parent16802cd0532abd2c6e750aa8a3254ba12173c65a (diff)
downloadydb-73a97f8c926a19e65e72d70448ffa34b7281f1bd.tar.gz
Fix building contrib/tools/{bison,m4} with musl-libc
Also: put devstack_targets.inc under musl autocheck. commit_hash:a824666c706272699d21127ad3d73694357f07ae
Diffstat (limited to 'contrib')
-rw-r--r--contrib/tools/bison/.yandex_meta/__init__.py29
-rw-r--r--contrib/tools/bison/lib/config-musl.h2
-rw-r--r--contrib/tools/bison/lib/ya.make15
-rw-r--r--contrib/tools/m4/.yandex_meta/__init__.py26
-rw-r--r--contrib/tools/m4/lib/config-musl.h9
-rw-r--r--contrib/tools/m4/lib/config.h4
-rw-r--r--contrib/tools/m4/lib/ya.make17
7 files changed, 93 insertions, 9 deletions
diff --git a/contrib/tools/bison/.yandex_meta/__init__.py b/contrib/tools/bison/.yandex_meta/__init__.py
index 52a66e9547..009d94080e 100644
--- a/contrib/tools/bison/.yandex_meta/__init__.py
+++ b/contrib/tools/bison/.yandex_meta/__init__.py
@@ -55,6 +55,12 @@ WINDOWS_SRCS = [
"windows-tls.h",
]
+MUSL_SRCS = [
+ "error.c",
+ "obstack.c",
+ "obstack_printf.c",
+]
+
DARWIN_SRCS = [
"error.c",
"fpending.c",
@@ -101,16 +107,31 @@ EXCESSIVE_SRCS = [
def post_install(self):
with self.yamakes["lib"] as gnulib:
+ # musl-libc has fseterr
+ gnulib.SRCS.remove("fseterr.c")
+ gnulib.after(
+ "SRCS",
+ """
+ IF (NOT MUSL)
+ SRCS(
+ fseterr.c
+ )
+ ENDIF()
+ """,
+ )
gnulib.after(
"SRCS",
Switch(
- OS_WINDOWS=Linkable(
- SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)],
- ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")],
+ MUSL=Linkable(
+ SRCS=MUSL_SRCS,
),
OS_DARWIN=Linkable(
SRCS=DARWIN_SRCS,
),
+ OS_WINDOWS=Linkable(
+ SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)],
+ ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")],
+ ),
),
)
for src in WINDOWS_SRCS:
@@ -162,7 +183,7 @@ bison = NixProject(
"src/scan-skel.l",
"src/parse-gram.y",
]
- + [f"lib/{src}" for src in itertools.chain(WINDOWS_SRCS, DARWIN_SRCS)],
+ + [f"lib/{src}" for src in itertools.chain(MUSL_SRCS, DARWIN_SRCS, WINDOWS_SRCS)],
copy_sources_except=[
# Don't need them for now, reduce import footprint
"data/skeletons/d.m4",
diff --git a/contrib/tools/bison/lib/config-musl.h b/contrib/tools/bison/lib/config-musl.h
index d8ad04c19e..41777d40f2 100644
--- a/contrib/tools/bison/lib/config-musl.h
+++ b/contrib/tools/bison/lib/config-musl.h
@@ -1,3 +1,5 @@
#define HAVE_SYS_TIMES_H 1
#define HAVE_STRUCT_TMS 1
#define HAVE_CLOCK_T 1
+
+#define _GL_ARG_NONNULL(...)
diff --git a/contrib/tools/bison/lib/ya.make b/contrib/tools/bison/lib/ya.make
index da1aacbe5c..38ca9b0120 100644
--- a/contrib/tools/bison/lib/ya.make
+++ b/contrib/tools/bison/lib/ya.make
@@ -60,7 +60,6 @@ SRCS(
fd-safer-flag.c
fd-safer.c
fopen-safer.c
- fseterr.c
fstrcmp.c
get-errno.c
gethrxtime.c
@@ -121,7 +120,19 @@ SRCS(
xtime.c
)
-IF (OS_DARWIN)
+IF (NOT MUSL)
+ SRCS(
+ fseterr.c
+ )
+ENDIF()
+
+IF (MUSL)
+ SRCS(
+ error.c
+ obstack.c
+ obstack_printf.c
+ )
+ELSEIF (OS_DARWIN)
SRCS(
error.c
fpending.c
diff --git a/contrib/tools/m4/.yandex_meta/__init__.py b/contrib/tools/m4/.yandex_meta/__init__.py
index 1c2fd5e7b1..657a7148a3 100644
--- a/contrib/tools/m4/.yandex_meta/__init__.py
+++ b/contrib/tools/m4/.yandex_meta/__init__.py
@@ -12,6 +12,7 @@ WINDOWS_SRCS = [
"error.c",
"float+.h",
"fpending.c",
+ "fseeko.c",
"getdtablesize.c",
"getopt.c",
"getopt1.c",
@@ -73,15 +74,28 @@ EXCESSIVE_SRCS = [
"wctype.h",
]
+MUSL_SRCS = [
+ "error.c",
+ "obstack.c",
+ "regex.c",
+]
+
def post_install(self):
+
with self.yamakes["lib"] as gnulib:
+ gnulib.SRCS.remove("freadahead.c")
+ gnulib.SRCS.remove("fseeko.c")
+
# Provide sys/random.h implementations which is used disregarding HAVE_SYS_RANDOM configuration value
gnulib.PEERDIR.add("contrib/libs/libc_compat")
gnulib.after(
"SRCS",
Switch(
+ MUSL=Linkable(
+ SRCS=[src for src in MUSL_SRCS if pathutil.is_source(src)],
+ ),
OS_WINDOWS=Linkable(
SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)],
ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")],
@@ -91,6 +105,18 @@ def post_install(self):
),
),
)
+
+ gnulib.after(
+ "SRCS",
+ """
+ IF (NOT MUSL)
+ SRCS(
+ freadahead.c
+ )
+ ENDIF()
+ """,
+ )
+
for src in WINDOWS_SRCS:
if pathutil.is_source(src) and src in gnulib.SRCS:
gnulib.SRCS.remove(src)
diff --git a/contrib/tools/m4/lib/config-musl.h b/contrib/tools/m4/lib/config-musl.h
new file mode 100644
index 0000000000..0f38ff5efd
--- /dev/null
+++ b/contrib/tools/m4/lib/config-musl.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define HAVE___FREADAHEAD 1
+
+#define regcomp rpl_regcomp
+#define regfree rpl_regfree
+
+#define _GL_ARG_NONNULL(...)
+#define _GL_ATTRIBUTE_FORMAT_PRINTF(...)
diff --git a/contrib/tools/m4/lib/config.h b/contrib/tools/m4/lib/config.h
index 1614a4f2b6..ec0b9be893 100644
--- a/contrib/tools/m4/lib/config.h
+++ b/contrib/tools/m4/lib/config.h
@@ -7,3 +7,7 @@
#else
# include "config-linux.h"
#endif
+
+#if defined(_musl_)
+# include "config-musl.h"
+#endif
diff --git a/contrib/tools/m4/lib/ya.make b/contrib/tools/m4/lib/ya.make
index 7602f70a92..6a13ee0518 100644
--- a/contrib/tools/m4/lib/ya.make
+++ b/contrib/tools/m4/lib/ya.make
@@ -52,8 +52,6 @@ SRCS(
filenamecat-lgpl.c
filenamecat.c
fopen-safer.c
- freadahead.c
- fseeko.c
getprogname.c
gl_avltree_oset.c
gl_linkedhash_list.c
@@ -103,7 +101,13 @@ SRCS(
xvasprintf.c
)
-IF (OS_DARWIN)
+IF (MUSL)
+ SRCS(
+ error.c
+ obstack.c
+ regex.c
+ )
+ELSEIF (OS_DARWIN)
SRCS(
error.c
fpending.c
@@ -120,6 +124,7 @@ ELSEIF (OS_WINDOWS)
dup2.c
error.c
fpending.c
+ fseeko.c
getdtablesize.c
getopt.c
getopt1.c
@@ -139,4 +144,10 @@ ELSEIF (OS_WINDOWS)
)
ENDIF()
+IF (NOT MUSL)
+ SRCS(
+ freadahead.c
+ )
+ENDIF()
+
END()