--- /dev/null
+DIST jsonnet-0.12.1.tar.gz 21839349 BLAKE2B 8601a35263003723b435d0075fe60f5301a49bddf63cdd55958df3eb7474569c28dbf54e0ba9d07fb6ade395af725193d1432b2c43fb2b271531af179e850df4 SHA512 25523dd19b4209a5ca39275ab3d3726b934442dd83a965ab0b79f0c67bd8ae85c438b2a63990b8eec921b137f908f946696be331b08cef92f15b6b8fa548cb0d
--- /dev/null
+diff --git a/setup.py b/setup.py
+index bfad34a..cfb30c3 100644
+--- a/setup.py
++++ b/setup.py
+@@ -68,9 +68,6 @@ setup(name='jsonnet',
+ author='David Cunningham',
+ author_email='dcunnin@google.com',
+ version=get_version(),
+- cmdclass={
+- 'build_ext': BuildJsonnetExt,
+- },
+ ext_modules=[jsonnet_ext],
+ test_suite="python._jsonnet_test",
+ )
--- /dev/null
+diff --git a/Makefile b/Makefile
+index c6d38e5..8dbaa9f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -29,8 +29,8 @@ OD ?= od
+
+ OPT ?= -O3
+
+-CXXFLAGS ?= -g $(OPT) -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json
+-CFLAGS ?= -g $(OPT) -Wall -Wextra -pedantic -std=c99 -fPIC -Iinclude
++CXXFLAGS += -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude -Ithird_party/md5 -Ithird_party/json
++CFLAGS += -Wall -Wextra -pedantic -std=c99 -fPIC -Iinclude
+ MAKEDEPENDFLAGS ?= -Iinclude -Ithird_party/md5 -Ithird_party/json
+ EMCXXFLAGS = $(CXXFLAGS) -g0 -Os --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0 -s OUTLINING_LIMIT=10000 -s RESERVED_FUNCTION_POINTERS=20 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1
+ EMCFLAGS = $(CFLAGS) --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1
+@@ -123,10 +123,10 @@ jsonnet: cmd/jsonnet.cpp $(LIB_OBJ)
+
+ # C binding.
+ libjsonnet.so: $(LIB_OBJ)
+- $(CXX) $(LDFLAGS) $(LIB_OBJ) $(SHARED_LDFLAGS) -o $@
++ $(CXX) $(LDFLAGS) $(LIB_OBJ) $(SHARED_LDFLAGS) -Wl,-soname,libjsonnet.so -o $@
+
+ libjsonnet++.so: $(LIB_CPP_OBJ)
+- $(CXX) $(LDFLAGS) $(LIB_CPP_OBJ) $(SHARED_LDFLAGS) -o $@
++ $(CXX) $(LDFLAGS) $(LIB_CPP_OBJ) $(SHARED_LDFLAGS) -Wl,-soname,libjsonnet++.so -o $@
+
+ # JavaScript build of C binding
+ JS_EXPORTED_FUNCTIONS = 'EXPORTED_FUNCTIONS=["_jsonnet_make", "_jsonnet_evaluate_snippet", "_jsonnet_fmt_snippet", "_jsonnet_ext_var", "_jsonnet_ext_code", "_jsonnet_tla_var", "_jsonnet_tla_code", "_jsonnet_realloc", "_jsonnet_destroy", "_jsonnet_import_callback"]'
--- /dev/null
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_6 python3_7 )
+
+inherit toolchain-funcs distutils-r1
+
+DESCRIPTION="A data templating language for app and tool developers "
+HOMEPAGE="http://jsonnet.org/"
+SRC_URI="https://github.com/google/jsonnet/archive/v0.12.1.tar.gz -> ${P}.tar.gz"
+IUSE="python"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+DEPEND="python? ( ${PYTHON_DEPS} )"
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+BDEPEND="python? ( ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+PATCHES=(
+ "${FILESDIR}/jsonnet-0.12.1-makefile.patch"
+ "${FILESDIR}/jsonnet-0.12.1-dont-call-make-from-setuppy.patch"
+)
+
+src_compile() {
+ emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ jsonnet \
+ libjsonnet.so \
+ libjsonnet++.so
+
+ use python && distutils-r1_src_compile
+}
+
+src_test() {
+ emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" test
+ use python && distutils-r1_src_test
+}
+
+python_test() {
+ esetup.py test || die
+}
+
+src_install() {
+ # no install target in the Makefile
+ exeinto /usr/$(get_libdir)
+ doexe libjsonnet*.so
+
+ dobin jsonnet
+
+ use python && distutils-r1_src_install
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>coles.david@gmail.com</email>
+ <name>David Coles</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>chutzpah@gentoo.org</email>
+ <name>Patrick McLean</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">google/jsonnet</remote-id>
+ </upstream>
+</pkgmetadata>