File: rules

package info (click to toggle)
lua5.3 5.3.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,464 kB
  • sloc: ansic: 16,564; makefile: 282; sh: 18
file content (76 lines) | stat: -rwxr-xr-x 2,689 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/make -f

# Uncomment to use ccache
#export CCACHE=/usr/lib/ccache/

ifeq (hurd,$(shell dpkg-architecture -qDEB_HOST_ARCH_OS))
	MYLIBS=-lpthread
endif

LUA_V = 5.3
LUA_FULL_V = 5.3.$(shell grep 'define LUA_VERSION_RELEASE' src/lua.h | cut -d '"' -f 2)
SONUM = 0
LUA = lua$(LUA_V)

DEB_DESTDIR := $(shell pwd)/debian/tmp/usr
LIB_PACKAGE_NAME = lib$(LUA)-$(SONUM)

PKG_DIR = $(DEB_DESTDIR)/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
PKG_CONFIG_FILE = $(PKG_DIR)/$(LUA).pc
PKG_CONFIG_FILE_FBSD = $(PKG_DIR)/lua-5.3.pc
PKG_CONFIG_FILE_NODOT = $(PKG_DIR)/lua53.pc
PKGPP_CONFIG_FILE = $(PKG_DIR)/$(LUA)-c++.pc
PKGPP_CONFIG_FILE_FBSD = $(PKG_DIR)/lua-5.3-c++.pc
PKGPP_CONFIG_FILE_NODOT = $(PKG_DIR)/lua53-c++.pc

LUA_MULTIARCH_INCLUDE = $(DEB_DESTDIR)/include/$(DEB_HOST_MULTIARCH)/
LUA_MULTIARCH = lua5.3-deb-multiarch.h
%:
	dh $@

override_dh_auto_configure:
	echo "#ifndef _LUA_DEB_MULTIARCH_" > src/$(LUA_MULTIARCH)
	echo "#define _LUA_DEB_MULTIARCH_" >> src/$(LUA_MULTIARCH)
	echo "#define DEB_HOST_MULTIARCH \"$(DEB_HOST_MULTIARCH)\"" >> \
		src/$(LUA_MULTIARCH)
	echo "#endif" >> src/$(LUA_MULTIARCH)

override_dh_auto_build:
	$(MAKE) linux MYLIBS=$(MYLIBS)

override_dh_auto_install:
	# pkgconfig
	mkdir -p $(PKG_DIR)
	echo "prefix=/usr" > $(PKG_CONFIG_FILE)
	echo "major_version=$(LUA_V)" >> $(PKG_CONFIG_FILE)
	echo "version=$(LUA_FULL_V)" >> $(PKG_CONFIG_FILE)
	echo "lib_name_include=lua$(LUA_V)" >> $(PKG_CONFIG_FILE)
	echo "deb_host_multiarch=$(DEB_HOST_MULTIARCH)" >> $(PKG_CONFIG_FILE)
	cat debian/lua.pc.in >> $(PKG_CONFIG_FILE)
	ln -s $(shell basename $(PKG_CONFIG_FILE)) $(PKG_CONFIG_FILE_FBSD)
	ln -s $(shell basename $(PKG_CONFIG_FILE)) $(PKG_CONFIG_FILE_NODOT)
	echo "prefix=/usr" > $(PKGPP_CONFIG_FILE)
	echo "major_version=$(LUA_V)" >> $(PKGPP_CONFIG_FILE)
	echo "version=$(LUA_FULL_V)" >> $(PKGPP_CONFIG_FILE)
	echo "lib_name_include=lua$(LUA_V)" >> $(PKGPP_CONFIG_FILE)
	echo "deb_host_multiarch=$(DEB_HOST_MULTIARCH)" >> $(PKGPP_CONFIG_FILE)
	cat debian/lua-c++.pc.in >> $(PKGPP_CONFIG_FILE)
	ln -s $(shell basename $(PKGPP_CONFIG_FILE)) $(PKGPP_CONFIG_FILE_FBSD)
	ln -s $(shell basename $(PKGPP_CONFIG_FILE)) $(PKGPP_CONFIG_FILE_NODOT)
	# manpage
	cat doc/lua.1  | sed 's/TH LUA 1/TH LUA5.3 1/' > doc/lua5.3.1
	cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC5.3 1/' > doc/luac5.3.1
	# multiarch
	mkdir -p $(LUA_MULTIARCH_INCLUDE)
	cp src/$(LUA_MULTIARCH) $(LUA_MULTIARCH_INCLUDE)
	$(MAKE) install
	mkdir -p $(DEB_DESTDIR)/share/lua$(LUA_V)/
	cp debian/version-script $(DEB_DESTDIR)/share/lua$(LUA_V)/

override_dh_auto_clean:
	dh_auto_clean
	rm -f doc/lua5.3.1 doc/luac5.3.1
	rm -f src/$(LUA_MULTIARCH)

override_dh_strip:
	dh_strip --dbg-package=$(LIB_PACKAGE_NAME)-dbg