stages: 2/04-iso: Do not include kernel build/source tree in the LiveCD
[dragora.git] / recipes / lua / lua5 / recipe
blobc1a472680825e349c1e46e9eb3f7a82857ad5c6c
1 # Build recipe for lua.
3 # Copyright (C) 2020 Kevin "The Nuclear" Bloom, <kevin.bloom@posteo.net>.
4 # Copyright (c) 2020-2022 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 #    http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Exit immediately on any error
19 set -e
21 program=lua
22 version=5.4.4
23 short_version="${version%.*}"
24 release=1
26 # Set custom package name to avoid conflicts on package upgrades
27 pkgname="lua${short_version%.*}"
29 # Define a category for the output of the package name
30 pkgcategory=lua
32 tarname=${program}-${version}.tar.gz
34 # Remote source(s)
35 fetch=https://www.lua.org/ftp/${tarname}
37 description="
38 A lightweight programming language designed for extending applications.
40 Lua is a powerful, efficient, lightweight, embeddable scripting language.
41 It supports procedural programming, object-oriented programming, functional
42 programming, data-driven programming, and data description.
45 homepage=https://www.lua.org/
46 license="MIT License"
48 # Source documentation
49 docs="doc/*.html doc/*.css doc/*.gif doc/*.png"
50 docsdir="${docdir}/${pkgname}-${version}"
52 _make_target()
54     make -j${jobs} \
55      MYCFLAGS="$QICFLAGS -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 -fPIC" \
56      MYLDFLAGS="$QILDFLAGS" \
57      INSTALL_LIB="${destdir}/usr/lib${libSuffix}" \
58      INSTALL_LMOD="${destdir}/usr/share/lua/${short_version}" \
59      INSTALL_CMOD="${destdir}/usr/lib${libSuffix}/lua/${short_version}" \
60      INSTALL_DATA="cp -d" \
61      INSTALL_MAN="${destdir}/${mandir}/man1" \
62      INSTALL_TOP="${destdir}/usr" "$@"
65 build()
67     unpack "${tardir}/$tarname"
69     cd "$srcdir"
71     # Set sane permissions
72     chmod -R u+w,go-w,a+rX-s .
74     patch -Np1 -i "${worktree}/patches/lua/lua-5.4.2-shared_library-1.patch"
76     # Adjust Lua search path
77     sed -e 's#/usr/local/#/usr/#' \
78         -e "s#lib/lua#lib${libSuffix}/lua#" \
79         -i src/luaconf.h
81     _make_target linux
82     _make_target install
84     # Now build the shared library
86     make clean
88     _make_target TO_LIB="liblua.so liblua.so.${short_version} liblua.so.${version}" linux
89     _make_target TO_LIB="liblua.so liblua.so.${short_version} liblua.so.${version}" install
91     unset -v make_target
93     # Strip remaining binaries and libraries
94     find "$destdir" -type f | xargs file | \
95      awk '/ELF/ && /executable/ || /shared object/' | \
96       cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
98     # Install a pkg-config file
99     mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
100     cat << EOF > "${destdir}/usr/lib${libSuffix}/pkgconfig/lua.pc"
101 prefix=/usr
102 INSTALL_BIN=\${prefix}/bin
103 INSTALL_INC=\${prefix}/include
104 INSTALL_LIB=\${prefix}/lib
105 INSTALL_MAN=\${prefix}/share/man/man1
106 INSTALL_LMOD=\${prefix}/share/lua/${short_version}
107 INSTALL_CMOD=\${prefix}/lib${libSuffix}/lua/${short_version}
108 exec_prefix=\${prefix}
109 libdir=\${exec_prefix}/lib${libSuffix}
110 includedir=\${prefix}/include
112 Name: Lua
113 Description: An Extensible Extension Language
114 Version: ${version}
115 Requires:
116 Libs: -L\${libdir} -llua -lm -ldl
117 Cflags: -I\${includedir}
120     unset -v short_version
122     # Compress manual page(s)
123     lzip -9 "${destdir}/${mandir}"/man1/*
125     # Copy documentation
126     mkdir -p "${destdir}/$docsdir"
127     cp -p $docs "${destdir}/$docsdir"