contribs: microdns: Fix scan failure when connectivity gets restored
[vlc.git] / contrib / src / lua / rules.mak
blobcdd4ce936b303115935fe3eb88abaaac33133212
1 # Lua 5.1
3 LUA_VERSION := 5.1.4
4 LUA_URL := http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz
6 # Reverse priority order
7 LUA_TARGET := generic
8 ifdef HAVE_BSD
9 LUA_TARGET := bsd
10 endif
11 ifdef HAVE_LINUX
12 LUA_TARGET := linux
13 endif
14 ifdef HAVE_MACOSX
15 LUA_TARGET := macosx
16 endif
17 ifdef HAVE_IOS
18 LUA_TARGET := ios
19 endif
20 ifdef HAVE_WIN32
21 LUA_TARGET := mingw
22 endif
23 ifdef HAVE_SOLARIS
24 LUA_TARGET := solaris
25 endif
27 # Feel free to add autodetection if you need to...
28 PKGS += lua luac
29 PKGS_ALL += luac
30 ifeq ($(call need_pkg,"lua5.2"),)
31 PKGS_FOUND += lua luac
32 endif
33 ifeq ($(call need_pkg,"lua5.1"),)
34 PKGS_FOUND += lua luac
35 endif
37 $(TARBALLS)/lua-$(LUA_VERSION).tar.gz:
38 $(call download_pkg,$(LUA_URL),lua)
40 .sum-lua: lua-$(LUA_VERSION).tar.gz
42 lua: lua-$(LUA_VERSION).tar.gz .sum-lua
43 $(UNPACK)
44 $(APPLY) $(SRC)/lua/lua-noreadline.patch
45 $(APPLY) $(SRC)/lua/no-dylibs.patch
46 $(APPLY) $(SRC)/lua/luac-32bits.patch
47 $(APPLY) $(SRC)/lua/no-localeconv.patch
48 $(APPLY) $(SRC)/lua/lua-ios-support.patch
49 $(APPLY) $(SRC)/lua/implib.patch
50 ifdef HAVE_WINSTORE
51 $(APPLY) $(SRC)/lua/lua-winrt.patch
52 endif
53 ifdef HAVE_DARWIN_OS
54 (cd $(UNPACK_DIR) && \
55 sed -e 's%gcc%$(CC)%' \
56 -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' \
57 -i.orig src/Makefile)
58 endif
59 ifdef HAVE_SOLARIS
60 (cd $(UNPACK_DIR) && \
61 sed -e 's%LIBS="-ldl"$$%LIBS="-ldl" MYLDFLAGS="$(EXTRA_LDFLAGS)"%' \
62 -i.orig src/Makefile)
63 endif
64 ifdef HAVE_WIN32
65 cd $(UNPACK_DIR) && sed -i.orig -e 's/lua luac/lua.exe luac.exe/' Makefile
66 endif
67 cd $(UNPACK_DIR)/src && sed -i.orig \
68 -e 's%CC=%#CC=%' \
69 -e 's%= *strip%=$(STRIP)%' \
70 -e 's%= *ranlib%= $(RANLIB)%' \
71 Makefile
72 $(MOVE)
74 .lua: lua
75 cd $< && $(HOSTVARS_PIC) $(MAKE) $(LUA_TARGET)
76 ifdef HAVE_WIN32
77 cd $</src && $(HOSTVARS) $(MAKE) liblua.a
78 endif
79 cd $< && $(HOSTVARS) $(MAKE) install INSTALL_TOP="$(PREFIX)"
80 ifdef HAVE_WIN32
81 cd $< && $(RANLIB) "$(PREFIX)/lib/liblua.a"
82 mkdir -p -- "$(PREFIX)/lib/pkgconfig"
83 cp $</etc/lua.pc "$(PREFIX)/lib/pkgconfig/"
84 endif
85 touch $@
87 .sum-luac: .sum-lua
88 touch $@
90 ifdef HAVE_WIN32
91 ifndef HAVE_CROSS_COMPILE
92 LUACVARS=CPPFLAGS="-DLUA_DL_DLL"
93 endif
94 endif
96 luac: lua-$(LUA_VERSION).tar.gz .sum-luac
97 # DO NOT use the same intermediate directory as the lua target
98 rm -Rf -- $@-$(LUA_VERSION) $@
99 mkdir -- $@-$(LUA_VERSION)
100 tar -x -v -z -C $@-$(LUA_VERSION) --strip-components=1 -f $<
101 (cd luac-$(LUA_VERSION) && patch -p1) < $(SRC)/lua/luac-32bits.patch
102 mv luac-$(LUA_VERSION) luac
104 .luac: luac
105 cd $< && $(LUACVARS) $(MAKE) generic
106 mkdir -p -- $(BUILDBINDIR)
107 install -m 0755 -s -- $</src/luac $(BUILDBINDIR)/$(HOST)-luac
108 touch $@