1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 2021-2025 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit flag-o-matic multilib multilib-minimal toolchain-funcs
|
|
6 |
inherit cmake flag-o-matic toolchain-funcs
|
7 |
7 |
|
8 |
|
DESCRIPTION="Network Audio System"
|
9 |
|
HOMEPAGE="https://radscan.com/nas.html"
|
10 |
|
SRC_URI="https://sourceforge.net/${PN}/${P}.tar.gz"
|
11 |
|
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-1.9.5-patches.tar.xz"
|
12 |
|
|
13 |
|
LICENSE="HPND MIT"
|
|
8 |
DESCRIPTION="A Modern Linker"
|
|
9 |
HOMEPAGE="https://github.com/rui314/mold"
|
|
10 |
if [[ ${PV} == 9999 ]] ; then
|
|
11 |
EGIT_REPO_URI="https://github.com/rui314/mold.git"
|
|
12 |
inherit git-r3
|
|
13 |
else
|
|
14 |
SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
15 |
# -alpha: https://github.com/rui314/mold/commit/3711ddb95e23c12991f6b8c7bfeba4f1421d19d4
|
|
16 |
KEYWORDS="-alpha ~amd64 ~arm ~arm64 ~loong ~ppc ~riscv ~sparc ~x86"
|
|
17 |
fi
|
|
18 |
|
|
19 |
# mold (MIT)
|
|
20 |
# - xxhash (BSD-2)
|
|
21 |
# - siphash ( MIT CC0-1.0 )
|
|
22 |
LICENSE="MIT BSD-2 CC0-1.0"
|
14 |
23 |
SLOT="0"
|
15 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~mips ppc ppc64 ~riscv sparc x86"
|
16 |
|
IUSE="doc static-libs"
|
|
24 |
IUSE="debug test"
|
|
25 |
RESTRICT="!test? ( test )"
|
17 |
26 |
|
18 |
27 |
RDEPEND="
|
19 |
|
x11-libs/libICE
|
20 |
|
x11-libs/libSM
|
21 |
|
x11-libs/libX11
|
22 |
|
x11-libs/libXau[${MULTILIB_USEDEP}]
|
23 |
|
x11-libs/libXaw
|
24 |
|
x11-libs/libXext
|
25 |
|
x11-libs/libXmu
|
26 |
|
x11-libs/libXpm
|
27 |
|
x11-libs/libXt[${MULTILIB_USEDEP}]"
|
28 |
|
DEPEND="
|
29 |
|
${RDEPEND}
|
30 |
|
x11-base/xorg-proto"
|
31 |
|
BDEPEND="
|
32 |
|
app-text/rman
|
33 |
|
app-alternatives/yacc
|
34 |
|
app-alternatives/lex
|
35 |
|
sys-devel/gcc
|
36 |
|
x11-misc/gccmakedep
|
37 |
|
riscv? ( x11-misc/xorg-cf-files )
|
38 |
|
>=x11-misc/imake-1.0.8-r1"
|
39 |
|
|
40 |
|
DOCS=( BUILDNOTES FAQ HISTORY README RELEASE TODO )
|
41 |
|
|
42 |
|
PATCHES=(
|
43 |
|
"${WORKDIR}"/${PN}-1.9.5-patches
|
44 |
|
"${FILESDIR}"/${PN}-1.9.5-gcc14-build-fix.patch
|
45 |
|
)
|
|
28 |
app-arch/zstd:=
|
|
29 |
>=dev-cpp/tbb-2021.7.0-r1:=
|
|
30 |
dev-libs/blake3:=
|
|
31 |
sys-libs/zlib
|
|
32 |
!kernel_Darwin? (
|
|
33 |
>=dev-libs/mimalloc-2:=
|
|
34 |
)
|
|
35 |
"
|
|
36 |
DEPEND="${RDEPEND}"
|
46 |
37 |
|
47 |
|
src_prepare() {
|
48 |
|
default
|
49 |
|
multilib_copy_sources
|
|
38 |
pkg_pretend() {
|
|
39 |
# Requires a c++20 compiler, see #831473
|
|
40 |
if [[ ${MERGE_TYPE} != binary ]]; then
|
|
41 |
if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
|
|
42 |
die "${PN} needs at least gcc 10"
|
|
43 |
elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
|
|
44 |
die "${PN} needs at least clang 12"
|
|
45 |
fi
|
|
46 |
fi
|
50 |
47 |
}
|
51 |
48 |
|
52 |
|
multilib_src_configure() {
|
53 |
|
# Ancient configure and relies on imake, not worth it
|
54 |
|
append-cflags -std=gnu89
|
55 |
|
|
56 |
|
# -Werror=lto-type-mismatch
|
57 |
|
# https://bugs.gentoo.org/859934
|
58 |
|
# https://sourceforge.net/p/nas/bugs/13/
|
59 |
|
filter-lto
|
60 |
|
|
61 |
|
# Need to run econf so that config.guess is updated
|
62 |
|
pushd config || die
|
63 |
|
econf
|
64 |
|
popd || die
|
65 |
|
|
66 |
|
# bug #947416
|
67 |
|
unset MAKEOPTS GNUMAKEFLAGS
|
68 |
|
|
69 |
|
local cpp=($(get_abi_CHOST ${DEFAULT_ABI})-gcc $(get_abi_CFLAGS) -E) #884203
|
70 |
|
CC="$(tc-getBUILD_CC)" LD="$(tc-getLD)" \
|
71 |
|
IMAKECPP="${IMAKECPP:-${cpp[*]}}" \
|
72 |
|
xmkmf -a || die
|
|
49 |
src_prepare() {
|
|
50 |
cmake_src_prepare
|
|
51 |
|
|
52 |
# Needs unpackaged dwarfdump
|
|
53 |
rm test/{{dead,compress}-debug-sections,compressed-debug-info}.sh || die
|
|
54 |
|
|
55 |
# Heavy tests, need qemu
|
|
56 |
rm test/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
|
|
57 |
rm test/lto-{archive,dso,gcc,llvm,version-script}.sh || die
|
|
58 |
|
|
59 |
# Sandbox sadness
|
|
60 |
rm test/run.sh || die
|
|
61 |
sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
|
|
62 |
test/mold-wrapper{,2}.sh || die
|
|
63 |
|
|
64 |
# Fails if binutils errors out on textrels by default
|
|
65 |
rm test/textrel.sh test/textrel2.sh || die
|
|
66 |
|
|
67 |
# Fails with (sometimes, maybe dependent on sys-devel/clang default
|
|
68 |
# linker):
|
|
69 |
# "/usr/bin/x86_64-pc-linux-gnu-ld.bfd: unrecognised emulation mode: llvm"
|
|
70 |
rm test/lto-llvm2.sh || die
|
|
71 |
|
|
72 |
# static-pie tests require glibc built with static-pie support
|
|
73 |
if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
|
|
74 |
rm test/{,ifunc-}static-pie.sh || die
|
|
75 |
fi
|
73 |
76 |
}
|
74 |
77 |
|
75 |
|
multilib_src_compile() {
|
76 |
|
# EXTRA_LDOPTIONS, SHLIBGLOBALSFLAGS #336564#c2
|
77 |
|
local emakeopts=(
|
78 |
|
AR="$(tc-getAR) cq"
|
79 |
|
AS="$(tc-getAS)"
|
80 |
|
CC="$(tc-getCC)"
|
81 |
|
CDEBUGFLAGS="${CFLAGS}"
|
82 |
|
CXX="$(tc-getCXX)"
|
83 |
|
CXXDEBUFLAGS="${CXXFLAGS}"
|
84 |
|
EXTRA_LDOPTIONS="${LDFLAGS}"
|
85 |
|
LD="$(tc-getLD)"
|
86 |
|
MAKE="${MAKE:-gmake}"
|
87 |
|
RANLIB="$(tc-getRANLIB)"
|
88 |
|
SHLIBGLOBALSFLAGS="${LDFLAGS}"
|
89 |
|
WORLDOPTS=
|
|
78 |
src_configure() {
|
|
79 |
use debug || append-cppflags "-DNDEBUG"
|
|
80 |
|
|
81 |
local mycmakeargs=(
|
|
82 |
-DBUILD_TESTING=$(usex test)
|
|
83 |
-DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.
|
|
84 |
-DMOLD_USE_MIMALLOC=$(usex !kernel_Darwin)
|
|
85 |
-DMOLD_USE_SYSTEM_MIMALLOC=ON
|
|
86 |
-DMOLD_USE_SYSTEM_TBB=ON
|
90 |
87 |
)
|
91 |
88 |
|
92 |
|
if multilib_is_native_abi ; then
|
93 |
|
# dumb fix for parallel make issue wrt #446598, Imake sux
|
94 |
|
emake "${emakeopts[@]}" -C server/dia all
|
95 |
|
emake "${emakeopts[@]}" -C server/dda/voxware all
|
96 |
|
emake "${emakeopts[@]}" -C server/os all
|
97 |
|
else
|
98 |
|
sed -i \
|
99 |
|
-e 's/SUBDIRS =.*/SUBDIRS = include lib config/' \
|
100 |
|
Makefile || die
|
|
89 |
if use test ; then
|
|
90 |
mycmakeargs+=(
|
|
91 |
-DMOLD_ENABLE_QEMU_TESTS=OFF
|
|
92 |
)
|
101 |
93 |
fi
|
102 |
94 |
|
103 |
|
emake "${emakeopts[@]}"
|
|
95 |
cmake_src_configure
|
104 |
96 |
}
|
105 |
97 |
|
106 |
|
multilib_src_install() {
|
107 |
|
# ranlib is used at install phase too wrt #446600
|
108 |
|
emake RANLIB="$(tc-getRANLIB)" \
|
109 |
|
DESTDIR="${D}" USRLIBDIR=/usr/$(get_libdir) \
|
110 |
|
install install.man
|
|
98 |
src_test() {
|
|
99 |
export TEST_CC="$(tc-getCC)" TEST_GCC="$(tc-getCC)" \
|
|
100 |
TEST_CXX="$(tc-getCXX)" TEST_GXX="$(tc-getCXX)"
|
|
101 |
cmake_src_test
|
111 |
102 |
}
|
112 |
103 |
|
113 |
|
multilib_src_install_all() {
|
114 |
|
einstalldocs
|
115 |
|
if use doc; then
|
116 |
|
docinto doc
|
117 |
|
dodoc doc/{actions,protocol.txt,README}
|
118 |
|
docinto pdf
|
119 |
|
dodoc doc/pdf/*.pdf
|
120 |
|
fi
|
121 |
|
|
122 |
|
mv -vf "${D}"/etc/nas/nasd.conf{.eg,} || die
|
123 |
|
|
124 |
|
newconfd "${FILESDIR}"/nas.conf.d nas
|
125 |
|
newinitd "${FILESDIR}"/nas.init.d nas
|
|
104 |
src_install() {
|
|
105 |
dobin "${BUILD_DIR}"/${PN}
|
126 |
106 |
|
127 |
|
if ! use static-libs; then
|
128 |
|
rm -f "${D}"/usr/lib*/libaudio.a || die
|
129 |
|
fi
|
|
107 |
# https://bugs.gentoo.org/872773
|
|
108 |
insinto /usr/$(get_libdir)/mold
|
|
109 |
doins "${BUILD_DIR}"/${PN}-wrapper.so
|
|
110 |
|
|
111 |
dodoc docs/{design,execstack}.md
|
|
112 |
doman docs/${PN}.1
|
|
113 |
|
|
114 |
dosym ${PN} /usr/bin/ld.${PN}
|
|
115 |
dosym ${PN} /usr/bin/ld64.${PN}
|
|
116 |
dosym -r /usr/bin/${PN} /usr/libexec/${PN}/ld
|
130 |
117 |
}
|