Package lua5.3-module-luasocket: Specfile

# Original package name LuaSocket
%define oname luasocket

Epoch: 1
Name: lua5.3-module-%oname
Version: 3.1.0
Release: alt1
Summary: Network support for the Lua language
License: MIT
Group: Development/Other
Url: http://luaforge.net/projects/luasocket/

%if "5.3" >= "5.3"
Obsoletes: lua-module-%oname < %EVR
Provides: lua-module-%oname = %version
%else
Obsoletes: lua5-%oname < %EVR
Provides: lua5-%oname = %version
%endif

Source: %oname-%version.tar
Patch1: lua-module-luasocket-3.0.0-alt-headers.patch

BuildRequires(pre): liblua5.3-devel lua5.3

%description
LuaSocket is a Lua extension library that is composed by two parts: a C core
that provides support for the TCP and UDP transport layers, and a set of Lua
modules that add support for functionality commonly needed by applications that
deal with the Internet.

%package devel
Summary: Headers for %name
Group: Development/Other
Requires: %name

%description devel
This package contains development files for %name.

%prep
%setup -n %oname-%version
%patch1 -p2

%build
%make_build linux \
	LUAV=%lua_version \
	CFLAGS_linux="%optflags -DLUASOCKET_NODEBUG -DLUA_COMPAT_APIINTCASTS" \
	#

%install
make install-unix INSTALL_DATA='install -p -m 644' \
	INSTALL_TOP=%buildroot \
	INSTALL_TOP_CDIR=%buildroot%lua_modulesdir \
	INSTALL_TOP_LDIR=%buildroot%lua_modulesdir_noarch \
	#

# install development files
install -d %buildroot%_includedir/luasocket
install -p -m 0644 src/*.h %buildroot%_includedir/luasocket

%check
subst 's|bin/lua$|bin/lua%current_lua_version|' test/udp-zero-length-send*
%lua_path_add_buildroot
( %lua test/testsrvr.lua ||: )&
sleep 1
%lua test/testclnt.lua

%files
%doc FIX LICENSE* CHANGELOG.md TODO WISH
%lua_modulesdir/*
%lua_modulesdir_noarch/*

%files devel
%_includedir/luasocket

%changelog
* Sat Oct 08 2022 Vladimir D. Seleznev <vseleznv@altlinux.org> 1:3.1.0-alt1
- Updated to 3.1.0.

* Sun Jul 03 2022 Vladimir D. Seleznev <vseleznv@altlinux.org> 1:3.0.0-alt1
- Updated to 3.0.0.
- Added devel subpackage.

* Tue Nov 12 2019 Ildar Mulyukov <ildar@altlinux.ru> 3.0rc1-alt4_lr2
- fix excessive dep on /usr/bin/lua

* Fri Jun 07 2019 Ildar Mulyukov <ildar@altlinux.ru> 3.0rc1-alt3_lr2
- autogenerated by lrimport
- restuctured according to https://www.altlinux.org/Lua_Policy

* Thu Jul 13 2017 Aleksei Nikiforov <darktemplar@altlinux.org> 3.0rc1-alt2
- Rebuild with new luarocks and lua-5.3

* Tue Oct 07 2014 Ildar Mulyukov <ildar@altlinux.ru> 3.0rc1-alt1_lr1
- autogenerated by lrimport

* Thu Jan 06 2011 Ildar Mulyukov <ildar@altlinux.ru> 2.0.2-alt1_lr3
- autogenerated by lrimport