Fix lib64 at luaconf.h
[platform/upstream/lua.git] / packaging / lua.spec
1 Name:           lua
2 Version:        5.1.5
3 Release:        0
4 License:        MIT
5 Summary:        Small Embeddable Language with Simple Procedural Syntax
6 Url:            http://www.lua.org
7 Group:          Base/Libraries
8 Source:         %{name}-%{version}.tar.gz
9 Source1:        macros.lua
10 Source2:        baselibs.conf
11 Source1001:     lua.manifest
12 %define major_version 5.1
13 BuildRequires:  pkg-config
14 BuildRequires:  readline-devel
15
16 %description
17 Lua is a programming language originally designed for extending
18 applications, but also frequently used as a general-purpose,
19 stand-alone language.
20
21 Lua combines simple procedural syntax (similar to Pascal) with powerful
22 data description constructs based on associative arrays and extensible
23 semantics. Lua is dynamically typed, interpreted from byte codes, and
24 has automatic memory management, making it ideal for configuration,
25 scripting, and rapid prototyping. Lua is implemented as a small library
26 of C functions, written in ANSI C, and the implementation goals are
27 simplicity, efficiency, portability, and low embedding cost.
28
29 %package devel
30 Summary:        Development files for lua
31 Group:          Development/Libraries
32 Requires:       %{name} = %{version}
33
34 %description devel
35 Lua is a programming language originally designed for extending
36 applications, but also frequently used as a general-purpose,
37 stand-alone language.
38
39 This package contains files needed for embedding lua into your
40 application.
41
42 %package -n liblua
43 Summary:        Small Embeddable Language with Simple Procedural Syntax
44 Group:          Base/Libraries
45
46 %description -n liblua
47 Lua is a programming language originally designed for extending
48 applications, but also frequently used as a general-purpose,
49 stand-alone language.
50
51 Lua combines simple procedural syntax (similar to Pascal) with powerful
52 data description constructs based on associative arrays and extensible
53 semantics. Lua is dynamically typed, interpreted from byte codes, and
54 has automatic memory management, making it ideal for configuration,
55 scripting, and rapid prototyping. Lua is implemented as a small library
56 of C functions, written in ANSI C, and the implementation goals are
57 simplicity, efficiency, portability, and low embedding cost.
58
59 %package doc
60 Summary:        Small Embeddable Language with Simple Procedural Syntax
61 Group:          Documentation
62 BuildArch:      noarch
63
64 %description doc
65 Lua is a programming language originally designed for extending
66 applications, but also frequently used as a general-purpose,
67 stand-alone language.
68
69 Lua combines simple procedural syntax (similar to Pascal) with powerful
70 data description constructs based on associative arrays and extensible
71 semantics. Lua is dynamically typed, interpreted from byte codes, and
72 has automatic memory management, making it ideal for configuration,
73 scripting, and rapid prototyping. Lua is implemented as a small library
74 of C functions, written in ANSI C, and the implementation goals are
75 simplicity, efficiency, portability, and low embedding cost.
76
77 %prep
78 %setup -q -n lua-%{version}
79 cp %{SOURCE1001} .
80
81 %build
82 export CFLAGS+=" -fPIC -DLUA_USE_LINUX"
83 export LDFLAGS+=" -Wl,-z,relro -Wl,-E -ldl -lreadline -lhistory -lncurses"
84 sed -i -e "s@/usr/local/@/usr/@g" src/luaconf.h
85
86 %ifarch x86_64 aarch64
87 sed -i -e "s/lib\//lib64\//g" src/luaconf.h
88 %endif
89
90 %{__make} %{?_smp_mflags} -C src CC="%{__cc}" MYCFLAGS="$CFLAGS" MYLIBS="$LDFLAGS" V=%{major_version} all
91
92 %check
93 %{__make} test || exit 0
94
95 %install
96 make install INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1"
97 install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
98 for file in lua luac ; do
99     mv "%{buildroot}%{_bindir}/${file}"        "%{buildroot}%{_bindir}/${file}%{major_version}"
100     mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1"
101 done
102 install -d -m 0755 %{buildroot}%{_libdir}/lua/%{major_version}
103 install -d -m 0755 %{buildroot}%{_datadir}/lua/%{major_version}
104 install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua
105
106 chmod +x %{buildroot}/%{_libdir}/liblua.so.%{major_version}
107
108 ln -s lua%{major_version} %{buildroot}%{_bindir}/lua
109
110 %remove_docs
111
112 %post -n liblua -p /sbin/ldconfig
113
114 %postun -n liblua -p /sbin/ldconfig
115
116 %files
117 %manifest %{name}.manifest
118 %defattr(-,root,root)
119 %license COPYRIGHT
120 %{_bindir}/lua
121 %{_bindir}/lua%{major_version}
122 %{_bindir}/luac%{major_version}
123 %dir %{_libdir}/lua
124 %dir %{_libdir}/lua/%{major_version}
125 %dir %{_datadir}/lua
126 %dir %{_datadir}/lua/%{major_version}
127 %{_sysconfdir}/rpm/macros.lua
128
129 %files -n liblua
130 %manifest %{name}.manifest
131 %defattr(-,root,root)
132 %license COPYRIGHT
133 %{_libdir}/liblua.so.%{major_version}
134
135 %files devel
136 %manifest %{name}.manifest
137 %defattr(-,root,root)
138 %{_includedir}/lauxlib.h
139 %{_includedir}/lua.h
140 %{_includedir}/lua.hpp
141 %{_includedir}/luaconf.h
142 %{_includedir}/lualib.h
143 %{_libdir}/pkgconfig/lua.pc
144 %{_libdir}/liblua.a
145 %{_libdir}/liblua.so
146
147 %changelog