Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Lua.txt 3.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  1. = Lua Packaging Guidelines
  2. :toc:
  3. == What is Lua?
  4. As described on the https://www.lua.org/[Lua website], Lua is
  5. "Lua is a powerful, efficient, lightweight, embeddable scripting language.
  6. It supports procedural programming, object-oriented programming, functional
  7. programming, data-driven programming, and data description."
  8. To learn Lua, read https://www.lua.org/pil/contents.html[Programming in Lua].
  9. == Spec Template for a Lua Package
  10. Many Lua packages use http://luarocks.org/[Lua-rocks] for packaging. It is helpful
  11. to examine the `+.rockspec+` specification as a guide in writing your spec file.
  12. Some packages require compilation of C programs, but others may be pure Lua. Both
  13. will have very similar install locations.
  14. ....
  15. Summary: Lua integration with libev
  16. Name: lua-ev
  17. License: MIT
  18. Version: 1.5
  19. Release: 2%{?dist}
  20. URL: https://github.com/brimworks/lua-ev
  21. Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
  22. BuildRequires: cmake
  23. BuildRequires: gcc
  24. BuildRequires: libev-devel
  25. BuildRequires: lua-devel
  26. %description
  27. Event loop programming with Lua.
  28. %prep
  29. %autosetup -n %{name}-%{version}
  30. %build
  31. %cmake -DINSTALL_CMOD=%{lua_libdir}
  32. %cmake_build
  33. %install
  34. %cmake_install
  35. %check
  36. #packaged tests do not work directly
  37. #Use example program as a smoke test
  38. LUA_CPATH=%{buildroot}%{lua_libdir}/?.so \
  39. lua example.lua
  40. LUA_CPATH=%{buildroot}%{lua_libdir}/?.so \
  41. lua -e 'ev = require "ev"; print(ev.version())'
  42. %files
  43. %license README
  44. %doc example.lua
  45. %{lua_libdir}/ev.so
  46. %changelog
  47. * Thu Dec 08 2022 Benson Muite <benson_muite@emailplus.org> - 1.5-1
  48. - Use README as license
  49. * Sat Nov 19 2022 Benson Muite <benson_muite@emailplus.org> - 1.5-2
  50. - Fix install location based on review
  51. - Add further smoke test
  52. * Wed Nov 16 2022 Benson Muite <benson_muite@emailplus.org> - 1.5-1
  53. - Initial release
  54. ....
  55. == Naming
  56. Lua add-on packages generally follow the naming scheme of `+lua-modulename+`
  57. -- e.g. `+lua-filesystem+`, `+lua-lpeg+`, `+lua-moonscript+`. If the module name
  58. makes it clear that it is an add-on for Lua, though, the module name
  59. itself is sufficient. e.g. `+lutok+`.
  60. Use your judgement -- e.g. the second `+l+` in `+lua-lpeg+` already stands for Lua,
  61. but it might not be seen as unambiguous enough.
  62. == Macros
  63. The following macros for packaging lua extensions are provided by the
  64. `+lua-devel+` package:
  65. [%header,cols=2*]
  66. |===
  67. | Macro | Description
  68. | `+%lua_version+` | version of system installed lua
  69. | `+%lua_libdir+` | installation directory for compiled modules
  70. | `+%lua_pkgdir+` | installation directory for arch-independent modules
  71. | `+%lua_requires+` | declares the needed runtime dependencies for the binary package
  72. |===
  73. For EPEL, define the following macros at the top of your spec file:
  74. ....
  75. %{!?lua_version: %global lua_version %{lua: print(string.sub(_VERSION, 5))}}
  76. # for compiled modules
  77. %{!?lua_libdir: %global lua_libdir %{_libdir}/lua/%{lua_version}}
  78. # for arch-independent modules
  79. %{!?lua_pkgdir: %global lua_pkgdir %{_datadir}/lua/%{lua_version}}
  80. ....
  81. To make the package pull the correct runtime dependencies, declare them like this:
  82. ....
  83. Requires: lua >= %{lua_version}
  84. Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)}
  85. ....
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...