Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/nix/files/, sys-apps/nix/
Date: Mon, 23 Jan 2017 21:24:14
Message-Id: 1485206643.fe992f877f5bc3bee3033b693a6f5a8601d423ca.slyfox@gentoo
1 commit: fe992f877f5bc3bee3033b693a6f5a8601d423ca
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 23 21:24:03 2017 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 23 21:24:03 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe992f87
7
8 sys-apps/nix: respect CFLAGS/CXXFLAGS/LDFLAGS, require boehm-gx[cxx]
9
10 Thanks to wiselord on freenode/#haskell-by who
11 noticed missing boehm-gx[cxx] DEPEND.
12
13 Package-Manager: Portage-2.3.3, Repoman-2.3.1
14
15 .../nix/files/nix-1.11.6-respect-CXXFLAGS.patch | 9 ++
16 .../nix/files/nix-1.11.6-respect-LDFLAGS.patch | 36 ++++++
17 sys-apps/nix/nix-1.11.6-r2.ebuild | 130 +++++++++++++++++++++
18 3 files changed, 175 insertions(+)
19
20 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
21 new file mode 100644
22 index 00000000..091fdca
23 --- /dev/null
24 +++ b/sys-apps/nix/files/nix-1.11.6-respect-CXXFLAGS.patch
25 @@ -0,0 +1,9 @@
26 +diff --git a/configure.ac b/configure.ac
27 +index 3a24053..1b99702 100644
28 +--- a/configure.ac
29 ++++ b/configure.ac
30 +@@ -57,4 +57,2 @@ fi
31 +
32 +-CFLAGS=
33 +-CXXFLAGS=
34 + AC_PROG_CC
35
36 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
37 new file mode 100644
38 index 00000000..12c094e
39 --- /dev/null
40 +++ b/sys-apps/nix/files/nix-1.11.6-respect-LDFLAGS.patch
41 @@ -0,0 +1,36 @@
42 +diff --git a/Makefile.config.in b/Makefile.config.in
43 +index f0de4da..c82fbfd 100644
44 +--- a/Makefile.config.in
45 ++++ b/Makefile.config.in
46 +@@ -5,2 +5,3 @@ CXX = @CXX@
47 + CXXFLAGS = @CXXFLAGS@
48 ++LDFLAGS = @LDFLAGS@
49 + HAVE_SODIUM = @HAVE_SODIUM@
50 +diff --git a/mk/libraries.mk b/mk/libraries.mk
51 +index 3cd7a53..f7bd015 100644
52 +--- a/mk/libraries.mk
53 ++++ b/mk/libraries.mk
54 +@@ -88,3 +88,3 @@ define build-library
55 + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
56 +- $$(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)
57 ++ $$(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)
58 +
59 +@@ -102,3 +102,3 @@ define build-library
60 + $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
61 +- $$(trace-ld) $(CXX) -o $$@ -shared $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
62 ++ $$(trace-ld) $(CXX) -o $$@ -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
63 +
64 +diff --git a/mk/programs.mk b/mk/programs.mk
65 +index 3ac6449..f553ce2 100644
66 +--- a/mk/programs.mk
67 ++++ b/mk/programs.mk
68 +@@ -34,3 +34,3 @@ define build-program
69 + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
70 +- $$(trace-ld) $(CXX) -o $$@ $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
71 ++ $$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
72 +
73 +@@ -48,3 +48,3 @@ define build-program
74 + $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
75 +- $$(trace-ld) $(CXX) -o $$@ $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
76 ++ $$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
77 +
78
79 diff --git a/sys-apps/nix/nix-1.11.6-r2.ebuild b/sys-apps/nix/nix-1.11.6-r2.ebuild
80 new file mode 100644
81 index 00000000..c9c976b
82 --- /dev/null
83 +++ b/sys-apps/nix/nix-1.11.6-r2.ebuild
84 @@ -0,0 +1,130 @@
85 +# Copyright 1999-2017 Gentoo Foundation
86 +# Distributed under the terms of the GNU General Public License v2
87 +# $Id$
88 +
89 +EAPI=6
90 +
91 +inherit autotools flag-o-matic readme.gentoo-r1 user
92 +
93 +DESCRIPTION="A purely functional package manager"
94 +HOMEPAGE="https://nixos.org/nix"
95 +
96 +SRC_URI="http://nixos.org/releases/${PN}/${P}/${P}.tar.xz"
97 +LICENSE="LGPL-2.1"
98 +SLOT="0"
99 +KEYWORDS="~amd64 ~x86"
100 +IUSE="+etc_profile +gc doc sodium"
101 +
102 +RDEPEND="
103 + app-arch/bzip2
104 + app-arch/xz-utils
105 + dev-db/sqlite
106 + dev-libs/openssl:0=
107 + net-misc/curl
108 + sys-libs/zlib
109 + gc? ( dev-libs/boehm-gc[cxx] )
110 + doc? ( dev-libs/libxml2
111 + dev-libs/libxslt
112 + app-text/docbook-xsl-stylesheets
113 + )
114 + sodium? ( dev-libs/libsodium )
115 + dev-lang/perl:=
116 + dev-perl/DBD-SQLite
117 + dev-perl/WWW-Curl
118 + dev-perl/DBI
119 +"
120 +DEPEND="${RDEPEND}
121 + >=sys-devel/bison-2.6
122 + >=sys-devel/flex-2.5.35
123 + virtual/perl-ExtUtils-ParseXS
124 +"
125 +
126 +PATCHES=(
127 + "${FILESDIR}"/${P}-systemd.patch
128 + "${FILESDIR}"/${P}-per-user.patch
129 + "${FILESDIR}"/${P}-respect-CXXFLAGS.patch
130 + "${FILESDIR}"/${P}-respect-LDFLAGS.patch
131 +)
132 +
133 +DISABLE_AUTOFORMATTING=yes
134 +DOC_CONTENTS=" Quick start user guide on Gentoo:
135 +
136 +[as root] enable nix-daemon service:
137 + [systemd] # systemctl enable nix-daemon
138 + [openrc] # rc-update add nix-daemon
139 +[as an user] relogin to get environment and profile update
140 +[as an user] fetch nixpkgs update:
141 + \$ nix-channel --update
142 +[as an user] install nix packages:
143 + \$ nix-env -i mc
144 +[as an user] configure environment:
145 + Somewhere in .bash_profile you might want to set
146 + LOCALE_ARCHIVE=\$HOME/.nix-profile/lib/locale/locale-archive
147 + but please read https://github.com/NixOS/nixpkgs/issues/21820
148 +
149 +Next steps:
150 + nix package manager user manual: http://nixos.org/nix/manual/
151 +"
152 +
153 +pkg_setup() {
154 + enewgroup nixbld 30000
155 + for i in {1..10}; do
156 + # we list 'nixbld' twice to
157 + # both assign a primary group for user
158 + # and add an user to /etc/group
159 + enewuser nixbld${i} $((30000 +$i)) -1 /var/empty nixbld,nixbld
160 + done
161 +}
162 +
163 +src_prepare() {
164 + default
165 +
166 + eautoreconf
167 +}
168 +
169 +src_configure() {
170 + econf \
171 + --localstatedir="${EPREFIX}"/nix/var \
172 + $(use_enable gc)
173 +}
174 +
175 +src_compile() {
176 + local make_vars=(
177 + OPTIMIZE=0 # disable hardcoded -O3
178 + V=1 # verbose build
179 + )
180 + emake "${make_vars[@]}"
181 +}
182 +
183 +src_install() {
184 + # TODO: emacs highlighter
185 + default
186 +
187 + readme.gentoo_create_doc
188 +
189 + # here we an eager variant of something that
190 + # is lazily done by nix-daemo and root nix-env
191 +
192 + # TODO: will need a tweak for prefix
193 + keepdir /nix/store
194 + fowners root:nixbld /nix/store
195 + fperms 1775 /nix/store
196 +
197 + keepdir /nix/var/nix/profiles/per-user
198 + fperms 1777 /nix/var/nix/profiles/per-user
199 +
200 + doenvd "${FILESDIR}"/60nix-remote-daemon
201 + newinitd "${FILESDIR}"/nix-daemon.initd nix-daemon
202 +
203 + if ! use etc_profile; then
204 + rm "${ED}"/etc/profile.d/nix.sh || die
205 + fi
206 +}
207 +
208 +pkg_postinst() {
209 + if ! use etc_profile; then
210 + ewarn "${EROOT}etc/profile.d/nix.sh was removed (due to USE=-etc_profile)."
211 + fi
212 +
213 + readme.gentoo_print_elog
214 +}