Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
@ 2024-12-13 12:59 Sergey Kaplun via Tarantool-patches
  2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-13 12:59 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

Since Alpine uses musl [1] as its C standard library, the build for it
failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
an error. This patch adds the check of the ID in the /etc/os-release [2]
of the Linux distribution and avoids setting the GLibC version if the
distro is "alpine".

[1]: https://wiki.alpinelinux.org/wiki/Musl
[2]: https://www.linux.org/docs/man5/os-release.html
---

Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-alpine-build
PR for tests on master: https://github.com/tarantool/tarantool/pull/10824
Side note: build locally in Docker for test for Alpine.

 test/CMakeLists.txt              |  1 +
 test/LuaJIT-tests/CMakeLists.txt | 18 +++++++++++-------
 test/cmake/GetLinuxDistro.cmake  | 18 ++++++++++++++++++
 3 files changed, 30 insertions(+), 7 deletions(-)
 create mode 100644 test/cmake/GetLinuxDistro.cmake

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index be02d2e4..86de9ed1 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -74,6 +74,7 @@ separate_arguments(LUAJIT_TEST_COMMAND)
 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 include(AddTestLib)
 include(GetLibCVersion)
+include(GetLinuxDistro)
 include(LibRealPath)
 
 # CTEST_FLAGS is used by CMake targets in test suites.
diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
index 0df3f4ea..adc630f0 100644
--- a/test/LuaJIT-tests/CMakeLists.txt
+++ b/test/LuaJIT-tests/CMakeLists.txt
@@ -62,13 +62,17 @@ if(CMAKE_C_FLAGS MATCHES "-march=skylake-avx512")
   list(APPEND LUAJIT_TEST_TAGS_EXTRA +avx512)
 endif()
 
-if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-  GetLibCVersion(LIBC_VERSION)
-  # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
-  # which have the bug [1] for "0x1p-2075" parsing. Add the skip
-  # check for it.
-  # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151
-  list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+  GetLinuxDistro(LINUX_DISTRO)
+  # Alpine uses musl instead of GLibC.
+  if(NOT LINUX_DISTRO MATCHES "alpine")
+    GetLibCVersion(LIBC_VERSION)
+    # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
+    # which have the bug [1] for "0x1p-2075" parsing. Add the skip
+    # check for it.
+    # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151
+    list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
+  endif()
 endif()
 
 if(LUAJIT_ENABLE_TABLE_BUMP)
diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
new file mode 100644
index 00000000..027368be
--- /dev/null
+++ b/test/cmake/GetLinuxDistro.cmake
@@ -0,0 +1,18 @@
+# Determine the Linux distro id and return it in the `output`
+# variable. See https://www.linux.org/docs/man5/os-release.html
+# for details.
+macro(GetLinuxDistro output)
+  if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
+  endif()
+  file(READ /etc/os-release OS_RELEASE)
+  string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
+  if(MATCH)
+    set(${output} ${CMAKE_MATCH_1})
+  else()
+    set(${output} linux)
+  endif()
+  unset(OS_RELEASE)
+  unset(MATCH)
+  unset(CMAKE_MATCH_1)
+endmacro()
-- 
2.47.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
  2024-12-13 12:59 [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine Sergey Kaplun via Tarantool-patches
@ 2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
  2024-12-13 14:45   ` Sergey Kaplun via Tarantool-patches
  2024-12-15  8:53 ` Maxim Kokryashkin via Tarantool-patches
  2024-12-17 12:33 ` Sergey Kaplun via Tarantool-patches
  2 siblings, 1 reply; 6+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-12-13 13:47 UTC (permalink / raw)
  To: Sergey Kaplun, Maxim Kokryashkin; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 4164 bytes --]

Hello again, Sergey,

thanks for the patch!

LGTM with minor comments, see below

On 13.12.2024 15:59, Sergey Kaplun wrote:
> Since Alpine uses musl [1] as its C standard library, the build for it
s/musl/Musl/
> failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
> fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
> an error. This patch adds the check of the ID in the /etc/os-release [2]
> of the Linux distribution and avoids setting the GLibC version if the
> distro is "alpine".
>
> [1]:https://wiki.alpinelinux.org/wiki/Musl
> [2]:https://www.linux.org/docs/man5/os-release.html

There is also a documentation about os-release on Freedesktop [1].

I would add this link as well. Feel free to ignore.


[1]: https://www.freedesktop.org/software/systemd/man/latest/os-release.html

> ---
>
> Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-alpine-build
> PR for tests on master:https://github.com/tarantool/tarantool/pull/10824
> Side note: build locally in Docker for test for Alpine.
>
>   test/CMakeLists.txt              |  1 +
>   test/LuaJIT-tests/CMakeLists.txt | 18 +++++++++++-------
>   test/cmake/GetLinuxDistro.cmake  | 18 ++++++++++++++++++
>   3 files changed, 30 insertions(+), 7 deletions(-)
>   create mode 100644 test/cmake/GetLinuxDistro.cmake
>
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index be02d2e4..86de9ed1 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -74,6 +74,7 @@ separate_arguments(LUAJIT_TEST_COMMAND)
>   set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
>   include(AddTestLib)
>   include(GetLibCVersion)
> +include(GetLinuxDistro)
>   include(LibRealPath)
>   
>   # CTEST_FLAGS is used by CMake targets in test suites.
> diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
> index 0df3f4ea..adc630f0 100644
> --- a/test/LuaJIT-tests/CMakeLists.txt
> +++ b/test/LuaJIT-tests/CMakeLists.txt
> @@ -62,13 +62,17 @@ if(CMAKE_C_FLAGS MATCHES "-march=skylake-avx512")
>     list(APPEND LUAJIT_TEST_TAGS_EXTRA +avx512)
>   endif()
>   
> -if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
> -  GetLibCVersion(LIBC_VERSION)
> -  # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
> -  # which have the bug [1] for "0x1p-2075" parsing. Add the skip
> -  # check for it.
> -  # [1]:https://sourceware.org/bugzilla/show_bug.cgi?id=16151
> -  list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
> +if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
> +  GetLinuxDistro(LINUX_DISTRO)
> +  # Alpine uses musl instead of GLibC.

s/musl/Musl/

s/GLibC/glibc/ or s/GLibC/GNU C Library/, see [2].

[2]: https://www.gnu.org/software/libc/

> +  if(NOT LINUX_DISTRO MATCHES "alpine")
> +    GetLibCVersion(LIBC_VERSION)
> +    # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
> +    # which have the bug [1] for "0x1p-2075" parsing. Add the skip
> +    # check for it.
> +    # [1]:https://sourceware.org/bugzilla/show_bug.cgi?id=16151
> +    list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
> +  endif()
>   endif()
>   
>   if(LUAJIT_ENABLE_TABLE_BUMP)
> diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
> new file mode 100644
> index 00000000..027368be
> --- /dev/null
> +++ b/test/cmake/GetLinuxDistro.cmake
> @@ -0,0 +1,18 @@
> +# Determine the Linux distro id and return it in the `output`
> +# variable. Seehttps://www.linux.org/docs/man5/os-release.html
> +# for details.
> +macro(GetLinuxDistro output)
> +  if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
> +    message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
> +  endif()
> +  file(READ /etc/os-release OS_RELEASE)

Fallback to /usr/lib/os-release as suggested in doc:

 > Applications should check for the former, and exclusively use its 
data if it exists, and only fall back to /usr/lib/os-release if it is 
missing.

> +  string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
> +  if(MATCH)
> +    set(${output} ${CMAKE_MATCH_1})
> +  else()
> +    set(${output} linux)
> +  endif()
> +  unset(OS_RELEASE)
> +  unset(MATCH)
> +  unset(CMAKE_MATCH_1)
> +endmacro()

[-- Attachment #2: Type: text/html, Size: 6152 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
  2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
@ 2024-12-13 14:45   ` Sergey Kaplun via Tarantool-patches
  2024-12-13 15:19     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 6+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-13 14:45 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches

Hi, Sergey!
Thanks for your comments!
Fixed them and force-pushed the branch.

On 13.12.24, Sergey Bronnikov wrote:
> Hello again, Sergey,
> 
> thanks for the patch!
> 
> LGTM with minor comments, see below
> 
> On 13.12.2024 15:59, Sergey Kaplun wrote:
> > Since Alpine uses musl [1] as its C standard library, the build for it
> s/musl/Musl/
> > failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
> > fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
> > an error. This patch adds the check of the ID in the /etc/os-release [2]
> > of the Linux distribution and avoids setting the GLibC version if the

Replaced typo: s/GLibC/glibc/.

> > distro is "alpine".
> >
> > [1]:https://wiki.alpinelinux.org/wiki/Musl
> > [2]:https://www.linux.org/docs/man5/os-release.html
> 
> There is also a documentation about os-release on Freedesktop [1].
> 
> I would add this link as well. Feel free to ignore.

Added, thanks!

> 
> 
> [1]: https://www.freedesktop.org/software/systemd/man/latest/os-release.html

The new commit message is the following:

| cmake: fix build for Alpine
|
| Since Alpine uses musl [1] as its C standard library, the build for it
| failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
| fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
| an error. This patch adds the check of the ID in the
| </etc/os-release> [2][3] of the Linux distribution and avoids setting
| the glibc version if the distro is "alpine".
|
| [1]: https://wiki.alpinelinux.org/wiki/Musl
| [2]: https://www.linux.org/docs/man5/os-release.html
| [3]: https://www.freedesktop.org/software/systemd/man/latest/os-release.html

> 
> > ---
> >
> > Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-alpine-build
> > PR for tests on master:https://github.com/tarantool/tarantool/pull/10824
> > Side note: build locally in Docker for test for Alpine.
> >

<snipped>

> > +if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
> > +  GetLinuxDistro(LINUX_DISTRO)
> > +  # Alpine uses musl instead of GLibC.
> 
> s/musl/Musl/

I've used as a reference (don't be confused by the links
themselfs) [1][2], looks like it should be "musl", after all.

[1]: https://wiki.alpinelinux.org/wiki/Musl
[2]: https://en.wikipedia.org/wiki/Musl

> 
> s/GLibC/glibc/ or s/GLibC/GNU C Library/, see [2].

Replaced with glibc.

===================================================================
diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
index adc630f0..c1dbde35 100644
--- a/test/LuaJIT-tests/CMakeLists.txt
+++ b/test/LuaJIT-tests/CMakeLists.txt
@@ -64,7 +64,7 @@ endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   GetLinuxDistro(LINUX_DISTRO)
-  # Alpine uses musl instead of GLibC.
+  # Alpine uses musl instead of glibc.
   if(NOT LINUX_DISTRO MATCHES "alpine")
     GetLibCVersion(LIBC_VERSION)
     # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
===================================================================

> 
> [2]: https://www.gnu.org/software/libc/
> 
> > +  if(NOT LINUX_DISTRO MATCHES "alpine")
> > +    GetLibCVersion(LIBC_VERSION)
> > +    # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
> > +    # which have the bug [1] for "0x1p-2075" parsing. Add the skip
> > +    # check for it.
> > +    # [1]:https://sourceware.org/bugzilla/show_bug.cgi?id=16151
> > +    list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
> > +  endif()
> >   endif()
> >   
> >   if(LUAJIT_ENABLE_TABLE_BUMP)
> > diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
> > new file mode 100644
> > index 00000000..027368be
> > --- /dev/null
> > +++ b/test/cmake/GetLinuxDistro.cmake
> > @@ -0,0 +1,18 @@
> > +# Determine the Linux distro id and return it in the `output`
> > +# variable. Seehttps://www.linux.org/docs/man5/os-release.html
> > +# for details.
> > +macro(GetLinuxDistro output)
> > +  if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
> > +    message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
> > +  endif()
> > +  file(READ /etc/os-release OS_RELEASE)
> 
> Fallback to /usr/lib/os-release as suggested in doc:
> 
>  > Applications should check for the former, and exclusively use its 
> data if it exists, and only fall back to /usr/lib/os-release if it is 
> missing.

Added the fallback:
===================================================================
diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
index 027368be..2636019c 100644
--- a/test/cmake/GetLinuxDistro.cmake
+++ b/test/cmake/GetLinuxDistro.cmake
@@ -5,13 +5,18 @@ macro(GetLinuxDistro output)
   if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
     message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
   endif()
-  file(READ /etc/os-release OS_RELEASE)
+  set(OS_RELEASE_FILE /etc/os-release)
+  if(NOT EXISTS ${OS_RELEASE_FILE})
+    set(OS_RELEASE_FILE /usr/lib/os-release)
+  endif()
+  file(READ ${OS_RELEASE_FILE} OS_RELEASE)
   string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
   if(MATCH)
     set(${output} ${CMAKE_MATCH_1})
   else()
     set(${output} linux)
   endif()
+  unset(OS_RELEASE_FILE)
   unset(OS_RELEASE)
   unset(MATCH)
   unset(CMAKE_MATCH_1)
===================================================================

> 
> > +  string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
> > +  if(MATCH)
> > +    set(${output} ${CMAKE_MATCH_1})
> > +  else()
> > +    set(${output} linux)
> > +  endif()
> > +  unset(OS_RELEASE)
> > +  unset(MATCH)
> > +  unset(CMAKE_MATCH_1)
> > +endmacro()

-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
  2024-12-13 14:45   ` Sergey Kaplun via Tarantool-patches
@ 2024-12-13 15:19     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 6+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-12-13 15:19 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 6532 bytes --]

Hi, Sergey,

LGTM, thanks!


I've also checked locally in Docker using Dockerfile below:


# docker build --tag alpine_test .
# docker run --network="host"  -ti alpine_test bash

FROM alpine:3.16

RUN apk update && apk upgrade
RUN apk add bash
RUN apk add git
RUN apk add vim
RUN apk add gcc
RUN apk add g++
RUN apk add gdb
RUN apk add make
RUN apk add cmake
RUN apk add linux-headers
RUN apk add libc-dev

RUN git clone https://github.com/tarantool/luajit && \
     cd luajit && \
     git checkout skaplun/gh-noticket-fix-alpine-build && \
     cmake -S . -B build -DLUAJIT_DISABLE_SYSPROF=ON && \
     cmake --build build --parallel && \
     cmake --build build --target test --parallel

On 13.12.2024 17:45, Sergey Kaplun wrote:
> Hi, Sergey!
> Thanks for your comments!
> Fixed them and force-pushed the branch.
>
> On 13.12.24, Sergey Bronnikov wrote:
>> Hello again, Sergey,
>>
>> thanks for the patch!
>>
>> LGTM with minor comments, see below
>>
>> On 13.12.2024 15:59, Sergey Kaplun wrote:
>>> Since Alpine uses musl [1] as its C standard library, the build for it
>> s/musl/Musl/
>>> failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
>>> fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
>>> an error. This patch adds the check of the ID in the /etc/os-release [2]
>>> of the Linux distribution and avoids setting the GLibC version if the
> Replaced typo: s/GLibC/glibc/.
Thanks!
>
>>> distro is "alpine".
>>>
>>> [1]:https://wiki.alpinelinux.org/wiki/Musl
>>> [2]:https://www.linux.org/docs/man5/os-release.html
>> There is also a documentation about os-release on Freedesktop [1].
>>
>> I would add this link as well. Feel free to ignore.
> Added, thanks!
Thanks!
>>
>> [1]:https://www.freedesktop.org/software/systemd/man/latest/os-release.html
> The new commit message is the following:
>
> | cmake: fix build for Alpine
> |
> | Since Alpine uses musl [1] as its C standard library, the build for it
> | failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test:
> | fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises
> | an error. This patch adds the check of the ID in the
> | </etc/os-release> [2][3] of the Linux distribution and avoids setting
> | the glibc version if the distro is "alpine".
> |
> | [1]:https://wiki.alpinelinux.org/wiki/Musl
> | [2]:https://www.linux.org/docs/man5/os-release.html
> | [3]:https://www.freedesktop.org/software/systemd/man/latest/os-release.html
>
>>> ---
>>>
>>> Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-alpine-build
>>> PR for tests on master:https://github.com/tarantool/tarantool/pull/10824
>>> Side note: build locally in Docker for test for Alpine.
>>>
> <snipped>
>
>>> +if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
>>> +  GetLinuxDistro(LINUX_DISTRO)
>>> +  # Alpine uses musl instead of GLibC.
>> s/musl/Musl/
> I've used as a reference (don't be confused by the links
> themselfs) [1][2], looks like it should be "musl", after all.
okay
> [1]:https://wiki.alpinelinux.org/wiki/Musl
> [2]:https://en.wikipedia.org/wiki/Musl
>
>> s/GLibC/glibc/ or s/GLibC/GNU C Library/, see [2].
> Replaced with glibc.
>
> ===================================================================
> diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
> index adc630f0..c1dbde35 100644
> --- a/test/LuaJIT-tests/CMakeLists.txt
> +++ b/test/LuaJIT-tests/CMakeLists.txt
> @@ -64,7 +64,7 @@ endif()
>   
>   if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
>     GetLinuxDistro(LINUX_DISTRO)
> -  # Alpine uses musl instead of GLibC.
> +  # Alpine uses musl instead of glibc.
>     if(NOT LINUX_DISTRO MATCHES "alpine")
>       GetLibCVersion(LIBC_VERSION)
>       # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
> ===================================================================
>
>> [2]:https://www.gnu.org/software/libc/
>>
>>> +  if(NOT LINUX_DISTRO MATCHES "alpine")
>>> +    GetLibCVersion(LIBC_VERSION)
>>> +    # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of
>>> +    # which have the bug [1] for "0x1p-2075" parsing. Add the skip
>>> +    # check for it.
>>> +    # [1]:https://sourceware.org/bugzilla/show_bug.cgi?id=16151
>>> +    list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION})
>>> +  endif()
>>>    endif()
>>>    
>>>    if(LUAJIT_ENABLE_TABLE_BUMP)
>>> diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
>>> new file mode 100644
>>> index 00000000..027368be
>>> --- /dev/null
>>> +++ b/test/cmake/GetLinuxDistro.cmake
>>> @@ -0,0 +1,18 @@
>>> +# Determine the Linux distro id and return it in the `output`
>>> +# variable. Seehttps://www.linux.org/docs/man5/os-release.html
>>> +# for details.
>>> +macro(GetLinuxDistro output)
>>> +  if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
>>> +    message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
>>> +  endif()
>>> +  file(READ /etc/os-release OS_RELEASE)
>> Fallback to /usr/lib/os-release as suggested in doc:
>>
>>   > Applications should check for the former, and exclusively use its
>> data if it exists, and only fall back to /usr/lib/os-release if it is
>> missing.
> Added the fallback:
> ===================================================================
> diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake
> index 027368be..2636019c 100644
> --- a/test/cmake/GetLinuxDistro.cmake
> +++ b/test/cmake/GetLinuxDistro.cmake
> @@ -5,13 +5,18 @@ macro(GetLinuxDistro output)
>     if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
>       message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux")
>     endif()
> -  file(READ /etc/os-release OS_RELEASE)
> +  set(OS_RELEASE_FILE /etc/os-release)
> +  if(NOT EXISTS ${OS_RELEASE_FILE})
> +    set(OS_RELEASE_FILE /usr/lib/os-release)
> +  endif()
> +  file(READ ${OS_RELEASE_FILE} OS_RELEASE)
>     string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
>     if(MATCH)
>       set(${output} ${CMAKE_MATCH_1})
>     else()
>       set(${output} linux)
>     endif()
> +  unset(OS_RELEASE_FILE)
>     unset(OS_RELEASE)
>     unset(MATCH)
>     unset(CMAKE_MATCH_1)
> ===================================================================
>
Thanks!
>>> +  string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE})
>>> +  if(MATCH)
>>> +    set(${output} ${CMAKE_MATCH_1})
>>> +  else()
>>> +    set(${output} linux)
>>> +  endif()
>>> +  unset(OS_RELEASE)
>>> +  unset(MATCH)
>>> +  unset(CMAKE_MATCH_1)
>>> +endmacro()

[-- Attachment #2: Type: text/html, Size: 10669 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
  2024-12-13 12:59 [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine Sergey Kaplun via Tarantool-patches
  2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
@ 2024-12-15  8:53 ` Maxim Kokryashkin via Tarantool-patches
  2024-12-17 12:33 ` Sergey Kaplun via Tarantool-patches
  2 siblings, 0 replies; 6+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2024-12-15  8:53 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Hi, Sergey!
Thanks for the patch!
LGTM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine
  2024-12-13 12:59 [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine Sergey Kaplun via Tarantool-patches
  2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
  2024-12-15  8:53 ` Maxim Kokryashkin via Tarantool-patches
@ 2024-12-17 12:33 ` Sergey Kaplun via Tarantool-patches
  2 siblings, 0 replies; 6+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-12-17 12:33 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

I've applied the patch into all long-term branches in tarantool/luajit
and bumped a new version in master [1], release/3.3 [2], release/3.2 [3]
and release/2.11 [4].

[1]: https://github.com/tarantool/tarantool/pull/10936
[2]: https://github.com/tarantool/tarantool/pull/10937
[3]: https://github.com/tarantool/tarantool/pull/10938
[4]: https://github.com/tarantool/tarantool/pull/10939

-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-17 12:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 12:59 [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine Sergey Kaplun via Tarantool-patches
2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches
2024-12-13 14:45   ` Sergey Kaplun via Tarantool-patches
2024-12-13 15:19     ` Sergey Bronnikov via Tarantool-patches
2024-12-15  8:53 ` Maxim Kokryashkin via Tarantool-patches
2024-12-17 12:33 ` Sergey Kaplun via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox