dev-lua/lua-openssl: new package github/pr/149
authorJakub Jirutka <jakub@jirutka.cz>
Sat, 3 Oct 2015 14:36:35 +0000 (16:36 +0200)
committerJakub Jirutka <jakub@jirutka.cz>
Tue, 6 Oct 2015 21:16:11 +0000 (23:16 +0200)
dev-lua/lua-openssl/Manifest [new file with mode: 0644]
dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch [new file with mode: 0644]
dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild [new file with mode: 0644]
dev-lua/lua-openssl/metadata.xml [new file with mode: 0644]

diff --git a/dev-lua/lua-openssl/Manifest b/dev-lua/lua-openssl/Manifest
new file mode 100644 (file)
index 0000000..1b7e99d
--- /dev/null
@@ -0,0 +1 @@
+DIST lua-openssl-0.4.1.tar.gz 363525 SHA256 cce51e33b07b6450854d2e57e129b5f369b749a780d58c44719c834f198ee340 SHA512 c6deda86f77f9d6de1863611db9eb82506ea9789ec0425cb40cdb7d142d53aa633d53e1446b7eeb464636261385822d9cedc841bd35163931cc3758e7c3a308d WHIRLPOOL cbb5367bc7b716bcde731340339e7dafc3b4c5a542e1cf30e4fcf1d6c720e4f49676afe33f77860ab1da0a55b6dde434d0c312ae42c96765512494c6e8bbeb49
diff --git a/dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch b/dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch
new file mode 100644 (file)
index 0000000..bf5374e
--- /dev/null
@@ -0,0 +1,86 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+
+Fix Makefile to respect system CFLAGS, LDFLAGS, and CC provided by environment.
+Allow to specify pkg-config command using variable, to be friendly with
+cross-compiling etc.
+
+diff --git a/Makefile b/Makefile
+index 195ef6b..375fb65 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,9 +2,10 @@ T=openssl
\r
+ PREFIX                ?=/usr/local\r
+ LIB_OPTION    ?= -shared \r
++PKG_CONFIG    ?= pkg-config\r
\r
+ #Lua auto detect\r
+-LUA_VERSION ?= $(shell pkg-config luajit --print-provides)\r
++LUA_VERSION ?= $(shell $(PKG_CONFIG) luajit --print-provides)\r
+ ifeq ($(LUA_VERSION),)                         ############ Not use luajit\r
+ LUAV          ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)")\r
+ LUA_CFLAGS    ?= -I$(PREFIX)/include/lua$(LUAV)\r
+@@ -12,8 +13,8 @@ LUA_LIBS     ?= -L$(PREFIX)/lib
+ LUA_LIBDIR    ?= $(PREFIX)/lib/lua/$(LUAV)\r
+ else\r
+ LUAV          ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)")\r
+-LUA_CFLAGS    ?= $(shell pkg-config luajit --cflags)\r
+-LUA_LIBS      ?= $(shell pkg-config luajit --libs)\r
++LUA_CFLAGS    ?= $(shell $(PKG_CONFIG) luajit --cflags)\r
++LUA_LIBS      ?= $(shell $(PKG_CONFIG) luajit --libs)\r
+ LUA_LIBDIR    ?= $(PREFIX)/lib/lua/$(LUAV)\r
+ endif\r
\r
+@@ -22,30 +23,30 @@ SYS := $(shell gcc -dumpmachine)
\r
+ ifneq (, $(findstring linux, $(SYS)))\r
+ # Do linux things\r
+-LDFLAGS                   = -fPIC -lrt -ldl\r
+-OPENSSL_LIBS  ?= $(shell pkg-config openssl --libs) \r
+-OPENSSL_CFLAGS        ?= $(shell pkg-config openssl --cflags)\r
+-CFLAGS                    = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
++LDFLAGS                   += -fPIC -lrt -ldl\r
++OPENSSL_LIBS  ?= $(shell $(PKG_CONFIG) openssl --libs) \r
++OPENSSL_CFLAGS        ?= $(shell $(PKG_CONFIG) openssl --cflags)\r
++CFLAGS                    += -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
+ endif\r
+ ifneq (, $(findstring apple, $(SYS)))\r
+ # Do darwin things\r
+-LDFLAGS                   = -fPIC -lrt -ldl\r
+-OPENSSL_LIBS  ?= $(shell pkg-config openssl --libs) \r
+-OPENSSL_CFLAGS        ?= $(shell pkg-config openssl --cflags)\r
+-CFLAGS                    = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
++LDFLAGS                   += -fPIC -lrt -ldl\r
++OPENSSL_LIBS  ?= $(shell $(PKG_CONFIG) openssl --libs) \r
++OPENSSL_CFLAGS        ?= $(shell $(PKG_CONFIG) openssl --cflags)\r
++CFLAGS                    += -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
+ endif\r
+ ifneq (, $(findstring mingw, $(SYS)))\r
+ # Do mingw things\r
+ V                     = $(shell lua -e "v=string.gsub('$(LUAV)','%.','');print(v)")\r
+-LDFLAGS               = -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll \r
++LDFLAGS               += -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll\r
+ LUA_CFLAGS    = -DLUA_LIB -DLUA_BUILD_AS_DLL -I$(PREFIX)/include/\r
+-CFLAGS                = $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
++CFLAGS                += $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
+ endif\r
+ ifneq (, $(findstring cygwin, $(SYS)))\r
+ # Do cygwin things\r
+-OPENSSL_LIBS  ?= $(shell pkg-config openssl --libs) \r
+-OPENSSL_CFLAGS  ?= $(shell pkg-config openssl --cflags)\r
+-CFLAGS                = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
++OPENSSL_LIBS  ?= $(shell $(PKG_CONFIG) openssl --libs) \r
++OPENSSL_CFLAGS  ?= $(shell $(PKG_CONFIG) openssl --cflags)\r
++CFLAGS                += -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)\r
+ endif\r
+ #custome config\r
+ ifeq (.config, $(wildcard .config))\r
+@@ -61,7 +62,7 @@ WARN_MOST    = -Wall -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnest
+ WARN          = -Wall -Wno-unused-value\r
+ WARN_MIN      = \r
+ CFLAGS                += $(WARN_MIN) -DPTHREADS \r
+-CC= gcc -g $(CFLAGS) -Ideps\r
++CC                    ?= gcc -g $(CFLAGS) -Ideps\r
\r
\r
+ OBJS=src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o \\r
diff --git a/dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild b/dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild
new file mode 100644 (file)
index 0000000..94b2ce6
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="OpenSSL binding for Lua"
+HOMEPAGE="https://github.com/zhaozg/lua-openssl"
+SRC_URI="https://github.com/zhaozg/lua-openssl/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT openssl PHP-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="luajit"
+
+RDEPEND="
+       luajit? ( dev-lang/luajit:2 )
+       !luajit? ( >=dev-lang/lua-5.1:0 )
+       dev-libs/openssl:0"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig"
+
+src_prepare() {
+       epatch "${FILESDIR}/${P}-Makefile.patch"
+       use luajit && LUAV=luajit || LUAV=lua
+}
+
+src_compile() {
+       local pkgconfig=$(tc-getPKG_CONFIG)
+       emake \
+               CC="$(tc-getCC) \$(CFLAGS) -Ideps" \
+               PKG_CONFIG="$pkgconfig" \
+               LUA_CFLAGS="$($pkgconfig --cflags $LUAV)" \
+               LUA_LIBS="$($pkgconfig --libs $LUAV)" \
+               LUA_LIBDIR="$($pkgconfig --variable INSTALL_CMOD $LUAV)"
+}
+
+src_install() {
+       emake \
+               LUA_LIBDIR="${D}$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD $LUAV)" \
+               install
+       einstalldocs
+}
diff --git a/dev-lua/lua-openssl/metadata.xml b/dev-lua/lua-openssl/metadata.xml
new file mode 100644 (file)
index 0000000..ea45693
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <herd>proxy-maintainers</herd>
+       <maintainer>
+               <email>jakub@jirutka.cz</email>
+               <name>Jakub Jirutka</name>
+       </maintainer>
+       <use>
+               <flag name="luajit">Use <pkg>dev-lang/luajit</pkg> instead of
+                       <pkg>dev-lang/lua</pkg></flag>
+       </use>
+       <upstream>
+               <remote-id type="github">zhaozg/lua-openssl</remote-id>
+       </upstream>
+</pkgmetadata>