1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DESCRIPTION="System for computational discrete algebra. Core functionality."
HOMEPAGE="https://www.gap-system.org/"
SRC_URI="https://github.com/gap-system/gap/releases/download/v${PV}/${P}-core.tar.gz"
LICENSE="GPL-2+"
SLOT="0/8"
KEYWORDS="~amd64"
IUSE="cpu_flags_x86_popcnt debug memcheck minimal readline test valgrind"
REQUIRED_USE="?? ( memcheck valgrind )"
RESTRICT="!test? ( test )"
# The minimum set of packages needed for basic GAP operation. You can
# actually start gap without these by passing "--bare" to it on the CLI,
# but don't expect anything to work.
REQUIRED_PKGS="
dev-gap/gapdoc
dev-gap/primgrp
dev-gap/smallgrp
dev-gap/transgrp"
# The packages aren't really required, but GAP tries to load them
# automatically, and will complain to the user if they fail to load.
# The list of automatically-loaded packages is a user preference, called
# AutoloadPackages, and the upstream default can be found in
# lib/package.gi within the GAP source tree. Passing "-A" to GAP on the
# CLI (or setting that user preference) will suppress the autoload
# behavior and allow GAP to start without these, which is why we allow
# the user to skip them with USE=minimal if he knows what he is doing.
AUTOLOADED_PKGS="
dev-gap/autpgrp
dev-gap/alnuth
dev-gap/crisp
dev-gap/ctbllib
dev-gap/factint
dev-gap/fga
dev-gap/irredsol
dev-gap/laguna
dev-gap/polenta
dev-gap/polycyclic
dev-gap/resclasses
dev-gap/sophus
dev-gap/tomlib"
# The test suite will fail without the "required" subset.
BDEPEND="test? ( ${REQUIRED_PKGS} )"
DEPEND="dev-libs/gmp:=
sys-libs/zlib
valgrind? ( dev-debug/valgrind )
readline? ( sys-libs/readline:= )"
RDEPEND="${DEPEND}"
# If you _really_ want to install GAP without the set of required
# packages, use package.provided.
PDEPEND="${REQUIRED_PKGS} !minimal? ( ${AUTOLOADED_PKGS} )"
PATCHES=( "${FILESDIR}/${P}-cc-and-cxx-for-gac.patch" )
pkg_setup() {
if use valgrind; then
elog "If you enable the use of valgrind during building"
elog "be sure that you have enabled the proper flags"
elog "in gcc to support it:"
elog "https://wiki.gentoo.org/wiki/Debugging#Valgrind"
fi
}
src_prepare() {
# Remove these to be extra sure we don't use bundled libraries.
rm -r extern || die
rm -r hpcgap/extern || die
# The Makefile just tells you to run ./configure, which then
# produces a GNUmakefile.
rm Makefile || die
# Prepend AC_CONFIG_MACRO_DIRS to configure.ac so that eautoreconf
# recreates aclocal.m4 correctly. Upstream bundles libtool-2.4.6,
# and Gentoo uses 2.4.7, so we need to regenerate aclocal.m4. BUT,
# upstream also uses m4_include directives in aclocal.m4 rather than
# AC_CONFIG_MACRO_DIRS in configure.ac. Without AC_CONFIG_MACRO_DIRS
# eautoreconf will omit all of the macros in cnf/m4.
sed -e '1s;^;AC_CONFIG_MACRO_DIRS([cnf/m4])\n;' -i configure.ac || die
default
# Fix feature detection with pathological CFLAGS
eautoreconf
}
src_configure() {
# We unset $ABI because GAP uses it internally for something else.
# --without-gmp and --without-zlib both trigger an AC_MSG_ERROR
local myeconfargs=(
ABI=""
--with-gmp
--with-zlib
$(use_enable cpu_flags_x86_popcnt popcnt)
$(use_enable memcheck memory-checking)
$(use_enable valgrind)
$(use_with readline)
$(use_enable debug)
)
econf "${myeconfargs[@]}"
}
src_compile() {
# Without this, the default is a quiet build.
emake V=1
}
src_test() {
# We need to specify additional root paths because otherwise the
# recently-built GAP doesn't know where to look for the "required"
# packages (which must already be installed). The two paths we
# append to $S are where those packages wind up.
local gaproots="${S}/;"
gaproots+="${EPREFIX}/usr/$(get_libdir)/gap/;"
gaproots+="${EPREFIX}/usr/share/gap/"
# GAPARGS is a Makefile variable that exists for this purpose. We
# use "-A" to hide the warnings about missing autoloaded-but-not-
# required packages.
emake GAPARGS="-A -l '${gaproots}'" check
}
src_install() {
default
# Manually install Makefile.gappkg
insinto usr/share/gap/etc
doins etc/Makefile.gappkg
# la files removal
find "${ED}" -type f -name '*.la' -delete || die
}
|