Skip to content

Commit e2bab76

Browse files
committed
Add rockspec
1 parent f60c7fa commit e2bab76

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

Makefile.luarocks

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ifndef VERBOSE
2+
.SILENT:
3+
endif
4+
5+
ifeq ($(OS), Windows_NT)
6+
LIBEXT = .dll
7+
LIBEXT_S = .dll.a
8+
COPY = copy
9+
RM = del
10+
else ifeq ($(shell uname -s),Darwin)
11+
LIBEXT = .dylib
12+
LIBEXT_S = .a
13+
COPY = cp -v
14+
RM = rm -v -f
15+
else
16+
LIBEXT = .so
17+
LIBEXT_S = .a
18+
COPY = cp -v
19+
RM = rm -v -f
20+
endif
21+
22+
TARGET = python$(LIBEXT)
23+
TARGET_S = python$(LIBEXT_S)
24+
25+
all: $(TARGET) $(TARGET_S)
26+
27+
##
28+
29+
CFLAGS := -Isrc -fPIC $(shell python3-config --embed --cflags) -DPYTHON_LIBRT=$(shell pkg-config python3-embed --keep-system-libs --libs | sed -e 's/-L//g' -e 's/ -l/\/lib/g')$(LIBEXT)
30+
31+
LDFLAGS := $(shell python3-config --embed --ldflags)
32+
ARFLAGS = $(shell python3-config --configdir)/libpython*$(LIBEXT_S)
33+
34+
OBJS := \
35+
src/pythoninlua.o \
36+
src/luainpython.o
37+
38+
$(TARGET): $(OBJS)
39+
echo " LD $@"
40+
$(LD) -shared -o $@ $^ $(LDFLAGS)
41+
42+
$(TARGET_S): $(OBJS)
43+
echo " AR $@"
44+
ar r $@ $^ $(ARFLAGS)
45+
46+
%.o: %.c
47+
echo " CC $@"
48+
$(CC) -c -o $@ $< $(CFLAGS)
49+
50+
install:
51+
$(COPY) $(TARGET) $(LIBDIR)/
52+
$(COPY) $(TARGET_S) $(LIBDIR)/
53+
54+
clean:
55+
$(RM) $(TARGET) $(TARGET_S) $(OBJS)

lunatic-python-scm-0.rockspec

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package = 'lunatic-python'
2+
version = 'scm-0'
3+
source = {
4+
url = 'git+https://github.com/bastibe/lunatic-python'
5+
}
6+
description = {
7+
summary = 'Two-way bridge between Python and Lua',
8+
homepage = 'https://github.com/bastibe/lunatic-python',
9+
license = 'LGPL-2.1'
10+
}
11+
build = {
12+
type = 'make',
13+
makefile = 'Makefile.luarocks',
14+
variables = {
15+
LIBDIR = '$(LIBDIR)'
16+
}
17+
}

0 commit comments

Comments
 (0)