1 # Build recipe for lua.
3 # Copyright (C) 2020 Kevin "The Nuclear" Bloom, <kevin.bloom@posteo.net>.
4 # Copyright (c) 2020 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.
20 short_version="${version%.*}"
23 # Set custom package name to avoid conflicts on package upgrades
24 pkgname="lua${short_version%.*}"
26 # Set 'outdir' for a nice and well-organized output directory
27 outdir="${outdir}/${arch}/lua"
29 tarname=${program}-${version}.tar.gz
32 fetch=http://www.lua.org/ftp/${tarname}
35 A lightweight programming language designed for extending applications.
37 Lua is a powerful, efficient, lightweight, embeddable scripting language.
38 It supports procedural programming, object-oriented programming, functional
39 programming, data-driven programming, and data description.
42 homepage=http://www.lua.org/
45 # Source documentation
46 docs="doc/*.html doc/*.css doc/*.gif doc/*.png"
47 docsdir="${docdir}/${pkgname}-${version}"
52 MYCFLAGS="$QICFLAGS -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" \
53 MYLDFLAGS="$QILDFLAGS" \
54 INSTALL_LIB="${destdir}/usr/lib${libSuffix}" \
55 INSTALL_LMOD="${destdir}/usr/share/lua/${short_version}" \
56 INSTALL_CMOD="${destdir}/usr/lib${libSuffix}/lua/${short_version}" \
57 INSTALL_DATA="cp -d" \
58 INSTALL_MAN="${destdir}/${mandir}/man1" \
59 INSTALL_TOP="${destdir}/usr" "$@"
66 unpack "${tardir}/$tarname"
70 # Set sane permissions
71 chmod -R u+w,go-w,a+rX-s .
73 # Adjust Lua search path
75 -e 's#/usr/local/#/usr/#' \
76 -e "s#lib/lua#lib${libSuffix}/lua#" \
80 sed -i "/R= /s|\$V\.4|${version}|" Makefile
85 # Now build the shared library
88 patch -Np1 -i "${worktree}/patches/lua/lua-5.3.5-shared_library-1.patch"
90 _make_target TO_LIB="liblua.so liblua.so.${short_version} liblua.so.${version}" linux
91 _make_target TO_LIB="liblua.so liblua.so.${short_version} liblua.so.${version}" install
95 # Install a pkg-config file
96 mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
97 cat << EOF > "${destdir}/usr/lib${libSuffix}/pkgconfig/lua.pc"
99 INSTALL_BIN=\${prefix}/bin
100 INSTALL_INC=\${prefix}/include
101 INSTALL_LIB=\${prefix}/lib
102 INSTALL_MAN=\${prefix}/share/man/man1
103 INSTALL_LMOD=\${prefix}/share/lua/${short_version}
104 INSTALL_CMOD=\${prefix}/lib${libSuffix}/lua/${short_version}
105 exec_prefix=\${prefix}
106 libdir=\${exec_prefix}/lib${libSuffix}
107 includedir=\${prefix}/include
110 Description: An Extensible Extension Language
113 Libs: -L\${libdir} -llua -lm -ldl
114 Cflags: -I\${includedir}
119 # Compress manual page(s)
120 lzip -9 "${destdir}/${mandir}"/man1/*
123 mkdir -p "${destdir}${docsdir}"
124 cp -p $docs "${destdir}${docsdir}"