sys-apps/nix: respect CFLAGS/CXXFLAGS/LDFLAGS, require boehm-gx[cxx]
authorSergei Trofimovich <slyfox@gentoo.org>
Mon, 23 Jan 2017 21:24:03 +0000 (21:24 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Mon, 23 Jan 2017 21:24:03 +0000 (21:24 +0000)
Thanks to wiselord on freenode/#haskell-by who
noticed missing boehm-gx[cxx] DEPEND.

Package-Manager: Portage-2.3.3, Repoman-2.3.1

sys-apps/nix/files/nix-1.11.6-respect-CXXFLAGS.patch [new file with mode: 0644]
sys-apps/nix/files/nix-1.11.6-respect-LDFLAGS.patch [new file with mode: 0644]
sys-apps/nix/nix-1.11.6-r2.ebuild [new file with mode: 0644]

diff --git a/sys-apps/nix/files/nix-1.11.6-respect-CXXFLAGS.patch b/sys-apps/nix/files/nix-1.11.6-respect-CXXFLAGS.patch
new file mode 100644 (file)
index 0000000..091fdca
--- /dev/null
@@ -0,0 +1,9 @@
+diff --git a/configure.ac b/configure.ac
+index 3a24053..1b99702 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -57,4 +57,2 @@ fi
+-CFLAGS=
+-CXXFLAGS=
+ AC_PROG_CC
diff --git a/sys-apps/nix/files/nix-1.11.6-respect-LDFLAGS.patch b/sys-apps/nix/files/nix-1.11.6-respect-LDFLAGS.patch
new file mode 100644 (file)
index 0000000..12c094e
--- /dev/null
@@ -0,0 +1,36 @@
+diff --git a/Makefile.config.in b/Makefile.config.in
+index f0de4da..c82fbfd 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -5,2 +5,3 @@ CXX = @CXX@
+ CXXFLAGS = @CXXFLAGS@
++LDFLAGS = @LDFLAGS@
+ HAVE_SODIUM = @HAVE_SODIUM@
+diff --git a/mk/libraries.mk b/mk/libraries.mk
+index 3cd7a53..f7bd015 100644
+--- a/mk/libraries.mk
++++ b/mk/libraries.mk
+@@ -88,3 +88,3 @@ define build-library
+     $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
+-      $$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED)
++      $$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED)
+@@ -102,3 +102,3 @@ define build-library
+     $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
+-      $$(trace-ld) $(CXX) -o $$@ -shared $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
++      $$(trace-ld) $(CXX) -o $$@ -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
+diff --git a/mk/programs.mk b/mk/programs.mk
+index 3ac6449..f553ce2 100644
+--- a/mk/programs.mk
++++ b/mk/programs.mk
+@@ -34,3 +34,3 @@ define build-program
+   $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
+-      $$(trace-ld) $(CXX) -o $$@ $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
++      $$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
+@@ -48,3 +48,3 @@ define build-program
+     $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
+-      $$(trace-ld) $(CXX) -o $$@ $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
++      $$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
diff --git a/sys-apps/nix/nix-1.11.6-r2.ebuild b/sys-apps/nix/nix-1.11.6-r2.ebuild
new file mode 100644 (file)
index 0000000..c9c976b
--- /dev/null
@@ -0,0 +1,130 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools flag-o-matic readme.gentoo-r1 user
+
+DESCRIPTION="A purely functional package manager"
+HOMEPAGE="https://nixos.org/nix"
+
+SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+etc_profile +gc doc sodium"
+
+RDEPEND="
+       app-arch/bzip2
+       app-arch/xz-utils
+       dev-db/sqlite
+       dev-libs/openssl:0=
+       net-misc/curl
+       sys-libs/zlib
+       gc? ( dev-libs/boehm-gc[cxx] )
+       doc? ( dev-libs/libxml2
+               dev-libs/libxslt
+               app-text/docbook-xsl-stylesheets
+       )
+       sodium? ( dev-libs/libsodium )
+       dev-lang/perl:=
+       dev-perl/DBD-SQLite
+       dev-perl/WWW-Curl
+       dev-perl/DBI
+"
+DEPEND="${RDEPEND}
+       >=sys-devel/bison-2.6
+       >=sys-devel/flex-2.5.35
+       virtual/perl-ExtUtils-ParseXS
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-systemd.patch
+       "${FILESDIR}"/${P}-per-user.patch
+       "${FILESDIR}"/${P}-respect-CXXFLAGS.patch
+       "${FILESDIR}"/${P}-respect-LDFLAGS.patch
+)
+
+DISABLE_AUTOFORMATTING=yes
+DOC_CONTENTS=" Quick start user guide on Gentoo:
+
+[as root] enable nix-daemon service:
+       [systemd] # systemctl enable nix-daemon
+       [openrc]  # rc-update add nix-daemon
+[as an user] relogin to get environment and profile update
+[as an user] fetch nixpkgs update:
+       \$ nix-channel --update
+[as an user] install nix packages:
+       \$ nix-env -i mc
+[as an user] configure environment:
+       Somewhere in .bash_profile you might want to set
+       LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
+       but please read https://github.com/NixOS/nixpkgs/issues/21820
+
+Next steps:
+       nix package manager user manual: http://nixos.org/nix/manual/
+"
+
+pkg_setup() {
+       enewgroup nixbld 30000
+       for i in {1..10}; do
+               # we list 'nixbld' twice to
+               # both assign a primary group for user
+               # and add an user to /etc/group
+               enewuser nixbld${i} $((30000 +$i)) -1 /var/empty nixbld,nixbld
+       done
+}
+
+src_prepare() {
+       default
+
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --localstatedir="${EPREFIX}"/nix/var \
+               $(use_enable gc)
+}
+
+src_compile() {
+       local make_vars=(
+               OPTIMIZE=0 # disable hardcoded -O3
+               V=1 # verbose build
+       )
+       emake "${make_vars[@]}"
+}
+
+src_install() {
+       # TODO: emacs highlighter
+       default
+
+       readme.gentoo_create_doc
+
+       # here we an eager variant of something that
+       # is lazily done by  nix-daemo and root nix-env
+
+       # TODO: will need a tweak for prefix
+       keepdir             /nix/store
+       fowners root:nixbld /nix/store
+       fperms 1775         /nix/store
+
+       keepdir             /nix/var/nix/profiles/per-user
+       fperms 1777         /nix/var/nix/profiles/per-user
+
+       doenvd "${FILESDIR}"/60nix-remote-daemon
+       newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
+
+       if ! use etc_profile; then
+               rm "${ED}"/etc/profile.d/nix.sh || die
+       fi
+}
+
+pkg_postinst() {
+       if ! use etc_profile; then
+               ewarn "${EROOT}etc/profile.d/nix.sh was removed (due to USE=-etc_profile)."
+       fi
+
+       readme.gentoo_print_elog
+}