Diff lua-5.1.5-r102 with a lua-5.2.3

/usr/portage/dev-lang/lua/lua-5.2.3.ebuild 2019-01-26 00:09:00.000000000 +0300
3 3

  
4 4
EAPI=5
5 5

  
6
inherit eutils multilib multilib-minimal portability toolchain-funcs versionator
6
inherit eutils autotools multilib portability toolchain-funcs versionator
7 7

  
8 8
DESCRIPTION="A powerful light-weight programming language designed for extending applications"
9 9
HOMEPAGE="http://www.lua.org/"
10 10
SRC_URI="http://www.lua.org/ftp/${P}.tar.gz"
11 11

  
12 12
LICENSE="MIT"
13
SLOT="5.1"
14
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
13
SLOT="5.2"
14
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-linux"
15 15
IUSE="+deprecated emacs readline static"
16 16

  
17
RDEPEND="readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )
17
RDEPEND="readline? ( sys-libs/readline:0= )
18 18
	app-eselect/eselect-lua
19 19
	!dev-lang/lua:0"
20 20
DEPEND="${RDEPEND}
21 21
	sys-devel/libtool"
22 22
PDEPEND="emacs? ( app-emacs/lua-mode )"
23 23

  
24
SAN_SLOT="${SLOT//.}"
25

  
26
MULTILIB_WRAPPED_HEADERS=(
27
	/usr/include/lua${SLOT}/luaconf.h
28
)
29

  
30 24
src_prepare() {
31 25
	local PATCH_PV=$(get_version_component_range 1-2)
32 26

  
33
	epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r2.patch
34
	epatch "${FILESDIR}"/${PN}-${PATCH_PV}-module_paths.patch
27
	epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r1.patch
35 28

  
36
	# use glibtool on Darwin (versus Apple libtool)
37
	if [[ ${CHOST} == *-darwin* ]] ; then
38
		sed -i -e '/LIBTOOL = /s:libtool:glibtool:' \
39
			Makefile src/Makefile || die
40
	fi
29
	[ -d "${FILESDIR}/${PV}" ] && \
30
		EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
41 31

  
42
	#EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
32
	sed -i \
33
		-e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \
34
		-e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \
35
		src/luaconf.h \
36
	|| die "failed patching luaconf.h"
43 37

  
44 38
	# correct lua versioning
45
	sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:5:1/' src/Makefile
39
	sed -i -e 's/\(LIB_VERSION = \)6:1:1/\10:0:0/' src/Makefile
46 40

  
47 41
	sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
48 42

  
49
	if ! use deprecated ; then
50
		# patches from 5.1.4 still apply
51
		epatch "${FILESDIR}"/${PN}-5.1.4-deprecated.patch
52
		epatch "${FILESDIR}"/${PN}-5.1.4-test.patch
53
	fi
54

  
55 43
	if ! use readline ; then
56
		epatch "${FILESDIR}"/${PN}-${PATCH_PV}-readline.patch
44
		sed -i -e '/#define LUA_USE_READLINE/d' src/luaconf.h
57 45
	fi
58 46

  
59 47
	# Using dynamic linked lua is not recommended for performance
......
63 51
	# compiler (built statically) nor the lua libraries (both shared and static
64 52
	# are installed)
65 53
	if use static ; then
66
		epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make_static-r1.patch
54
		sed -i -e 's:\(-export-dynamic\):-static \1:' src/Makefile
67 55
	fi
68 56

  
69
	# A slotted Lua uses different directories for headers & names for
70
	# libraries, and pkgconfig should reflect that.
71
	sed -r -i \
72
		-e "/^Libs:/s,((-llua)($| )),\2${SLOT}\3," \
73
		-e "/^Cflags:/s,((-I..includedir.)($| )),\2/lua${SLOT}\3," \
74
		"${S}"/etc/lua.pc
75

  
76
	# custom Makefiles
77
	multilib_copy_sources
78
}
79

  
80
multilib_src_configure() {
81
	# We want packages to find our things...
82
	sed -i \
83
		-e 's:/usr/local:'${EPREFIX}'/usr:' \
84
		-e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \
85
		etc/lua.pc src/luaconf.h || die
57
	# upstream does not use libtool, but we do (see bug #336167)
58
	cp "${FILESDIR}/configure.in" "${S}"
59
	eautoreconf
86 60
}
87 61

  
88
multilib_src_compile() {
62
src_compile() {
89 63
	tc-export CC
90
	myflags=
64

  
91 65
	# what to link to liblua
92 66
	liblibs="-lm"
93 67
	liblibs="${liblibs} $(dlopen_lib)"
94 68

  
95 69
	# what to link to the executables
96 70
	mylibs=
97
	if use readline; then
98
		mylibs="-lreadline"
99
	fi
71
	use readline && mylibs="-lreadline"
100 72

  
101 73
	cd src
102
	emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${CFLAGS}" \
74

  
75
	local myCFLAGS=""
76
	use deprecated && myCFLAGS="-DLUA_COMPAT_ALL"
77

  
78
	case "${CHOST}" in
79
		*-mingw*) : ;;
80
		*) myCFLAGS+=" -DLUA_USE_LINUX" ;;
81
	esac
82

  
83
	emake CC="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \
84
			SYSLDFLAGS="${LDFLAGS}" \
103 85
			RPATH="${EPREFIX}/usr/$(get_libdir)/" \
104 86
			LUA_LIBS="${mylibs}" \
105 87
			LIB_LIBS="${liblibs}" \
106 88
			V=$(get_version_component_range 1-2) \
107
			gentoo_all
108

  
109
	mv lua_test ../test/lua.static
89
			gentoo_all || die "emake failed"
110 90
}
111 91

  
112
multilib_src_install() {
92
src_install() {
113 93
	emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
114
			V=${SLOT} gentoo_install
115

  
116
	insinto /usr/$(get_libdir)/pkgconfig
117
	newins etc/lua.pc lua${SLOT}.pc
118
}
94
			V=${SLOT} gentoo_install \
95
	|| die "emake install gentoo_install failed"
119 96

  
120
multilib_src_install_all() {
121
	dodoc HISTORY README
97
	dodoc README
122 98
	dohtml doc/*.html doc/*.png doc/*.css doc/*.gif
123 99

  
124
	doicon etc/lua.ico
125

  
126 100
	newman doc/lua.1 lua${SLOT}.1
127 101
	newman doc/luac.1 luac${SLOT}.1
128
}
129 102

  
130
multilib_src_test() {
131
	local positive="bisect cf echo env factorial fib fibfor hello printf sieve
132
	sort trace-calls trace-globals"
133
	local negative="readonly"
134
	local test
135

  
136
	cd "${BUILD_DIR}" || die
137
	for test in ${positive}; do
138
		test/lua.static test/${test}.lua || die "test $test failed"
139
	done
140

  
141
	for test in ${negative}; do
142
		test/lua.static test/${test}.lua && die "test $test failed"
143
	done
103
	# We want packages to find our things...
104
	cp "${FILESDIR}/lua.pc" "${WORKDIR}"
105
	sed -i \
106
		-e "s:^V=.*:V= ${PATCH_PV}:" \
107
		-e "s:^R=.*:R= ${PV}:" \
108
		-e "s:/,lib,:/$(get_libdir):g" \
109
		"${WORKDIR}/lua.pc"
110

  
111
	insinto "/usr/$(get_libdir)/pkgconfig"
112
	newins "${WORKDIR}/lua.pc" "lua${SLOT}.pc"
144 113
}
114

  
115
# Makefile contains a dummy target that doesn't do tests
116
# but causes issues with slotted lua (bug #510360)
117
src_test() { :; }
Thank you!