Jérôme Vuarand avatar Jérôme Vuarand committed 5815123

Improved Lua 5.2 support, removed references to LUAMOD_API.

Comments (0)

Files changed (4)

 DLLEXT=so
 endif
 
+LUA_VERSION?=5.1
+
 PREFIX?=/usr/local
-INSTALL_LUA=$(PREFIX)/share/lua/5.1
-INSTALL_BIN=$(PREFIX)/lib/lua/5.1
+INSTALL_LUA=$(PREFIX)/share/lua/$(LUA_VERSION)
+INSTALL_BIN=$(PREFIX)/lib/lua/$(LUA_VERSION)
 CPPFLAGS=-Wall -Wextra -Werror -O2
 CFLAGS=-fvisibility=hidden
 
 ifeq ($(OS),Linux)
-CPPFLAGS+=-I/usr/include/libusb-1.0
+CPPFLAGS+=-I/usr/include/libusb-1.0 "-DLUAUSB_API=__attribute__((visibility(\"default\")))"
 CFLAGS+=-fPIC
 LDLIBS+=-lusb-1.0
 endif
 ifeq ($(OS),Windows_NT)
+ifneq ($(LUA_VERSION),5.1)
+$(error only Lua 5.1 is supported on Windows)
+endif
 ARCH=32
 LIBUSB_DIR=./libusbx-1.0.14-win
 LUABIN_DIR=./lua5_1_4_Win$(ARCH)_dll8_lib
-CPPFLAGS+=-I$(LUABIN_DIR)/include -I$(LIBUSB_DIR)/include/libusbx-1.0 "-DLUAMOD_API=__declspec(dllexport)"
+CPPFLAGS+=-I$(LUABIN_DIR)/include -I$(LIBUSB_DIR)/include/libusbx-1.0 "-DLUAUSB_API=__declspec(dllexport)"
 LDLIBS+=-l:$(LUABIN_DIR)/lua5.1.dll -l:$(LIBUSB_DIR)/MinGW$(ARCH)/dll/libusb-1.0.dll
 endif
 
 
 /****************************************************************************/
 
-#ifndef LUAMOD_API
-#	ifdef WIN32
-#		define LUAMOD_API __declspec(dllexport)
-#	else
-#		define LUAMOD_API __attribute__((visibility("default")))
-#	endif
-#endif
-
 #if LUA_VERSION_NUM==502
 
 int typeerror(lua_State* L, int narg, const char* tname);

prtr-luausb.rockspec.in

 				'enums.c',
 			},
 			defines = {
-				'LUAMOD_API=LUALIB_API',
+				'LUAUSB_API=LUALIB_API',
 				'luaopen_module=luaopen_usb',
 			},
 			libraries = { 'usb-1.0' },
 
 /****************************************************************************/
 
-LUAMOD_API int luaopen_module(lua_State* L)
+LUAUSB_API int luaopen_module(lua_State* L)
 {
 	/* module */
 #if LUA_VERSION_NUM==502
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.