commit: f4e1dc7cac0ca6d622dc98f4aa52a3cbae9f6efb
parent 0cdae00a1782c7b72f54251576e2628923b3de36
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 17 Feb 2022 16:22:01 +0100
dev-elixir/hex: Re-add, with version bump
Diffstat:
5 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/dev-elixir/hex/Manifest b/dev-elixir/hex/Manifest
@@ -0,0 +1 @@
+DIST hex-1.0.1.tar.gz 438918 BLAKE2B 135c99243956ccd085fd58a56fbb7a96b6d7fd49ce506e54abd5cfbc702f4e82b64ed70e33b4a5ee015d5dade7166b080bf2e1360d51fc133451cfe748b42da7 SHA512 2e0773726fc27746133b0c5067295f0d902eff853ab0ae9d0e35c5d6a146c5e29569ffe634557bbaf1824b46b42ac5c6551409b180442b89d8238db7c5274e7b
diff --git a/dev-elixir/hex/hex-1.0.1.ebuild b/dev-elixir/hex/hex-1.0.1.ebuild
@@ -0,0 +1,15 @@
+# Copyright 2019-2022 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit mix
+
+DESCRIPTION="Package manager for the Erlang VM"
+HOMEPAGE="https://github.com/hexpm/hex"
+LICENSE="Apache-2.0"
+SLOT="$(ver_cut 1-2)"
+SRC_URI="https://github.com/hexpm/hex/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+
+# TODO: tests (requires dependencies)
diff --git a/dev-elixir/hex/metadata.xml b/dev-elixir/hex/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>contact@hacktivis.me</email>
+ <name>Haelwenn (lanodan) Monnier</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/eclass/mix.eclass b/eclass/mix.eclass
@@ -0,0 +1,95 @@
+# Copyright 2019-2022 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: mix.eclass
+# @MAINTAINER:
+# Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# @AUTHOR:
+# Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# @SUPPORTED_EAPIS: 6 7
+# @BLURB: Build Elixir projects using dev-util/mix.
+# @DESCRIPTION:
+# An eclass providing functions to build Elixir projects using dev-util/mix.
+#
+# mix is a tool which tries to resolve dependencies itself
+
+case "${EAPI:-0}" in
+ 0|1|2|3|4|5)
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+ ;;
+ 6|7)
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
+esac
+
+EXPORT_FUNCTIONS src_prepare src_compile src_install
+
+RDEPEND="dev-lang/elixir"
+DEPEND="${RDEPEND}"
+
+# Erlang/Elixir software fails to build when another version with API
+# differences is present
+BDEPEND="!<${CATEGORY}/${P} !>${CATEGORY}/${P}"
+
+# @ECLASS-VARIABLE: HEX_OFFLINE
+HEX_OFFLINE=1
+
+# @ECLASS-VARIABLE: MIX_ENV
+MIX_ENV="prod"
+
+# @ECLASS-VARIABLE: MIX_NO_DEPS
+MIX_NO_DEPS=1
+
+# @FUNCTION: emix
+# @USAGE: <targets>
+# @DESCRIPTION:
+# Run mix with whatever. Die on failure
+emix() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (( $# > 0 )) || die "emix: at least one target is required"
+
+ MIX_ENV="${MIX_ENV}" mix "$@" || die -n "mix $@ failed"
+}
+
+# @ECLASS-VARIABLE: MIX_REWRITE
+MIX_REWRITE=""
+
+# @ECLASS-VARIABLE: MIX_BUILD_NAME
+MIX_BUILD_NAME="${MIX_ENV}"
+
+# @FUNCTION: mix_src_prepare
+mix_src_prepare() {
+ if [[ "${MIX_REWRITE}" != "" ]]
+ then
+ sed -i -E -e 's@\{.*(only|optional): .*},?@@' mix.exs || die "failed removing only & optionnal deps"
+ rm -f mix.lock
+ fi
+
+ default
+}
+
+# @FUNCTION: mix_src_compile
+# @DESCRIPTION:
+# Compile project with mix.
+mix_src_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ emix compile --no-deps-check
+}
+
+# @FUNCTION: mix_src_install
+# @DESCRIPTION:
+# Install project with mix.
+mix_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ insinto "/usr/$(get_libdir)/elixir/lib/${P}"
+ pushd "_build/${MIX_BUILD_NAME}/lib/${PN}" >/dev/null
+ for reldir in src ebin priv include; do
+ [ -d "$reldir" ] && doins -r "$(realpath ${reldir})"
+ done
+ popd >/dev/null
+}
diff --git a/profiles/categories b/profiles/categories
@@ -1 +1,2 @@
app-vis
+dev-elixir