Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darwin.libiconv: 50 -> 99 and move to pkgs/by-name #301354

Merged
merged 9 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/applications/editors/vim/macvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, perl
, luajit
, darwin
, libiconv
, python3
}:

Expand Down Expand Up @@ -127,7 +128,7 @@ stdenv.mkDerivation {
--replace " -L${stdenv.cc.libc}/lib" "" \
--replace " -L${darwin.libobjc}/lib" "" \
--replace " -L${darwin.libunwind}/lib" "" \
--replace " -L${darwin.libiconv}/lib" ""
--replace " -L${libiconv}/lib" ""

# All the libraries we stripped have -osx- in their name as of this time.
# Assert now that this pattern no longer appears in config.mk.
Expand Down
89 changes: 89 additions & 0 deletions pkgs/by-name/at/atf/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
autoreconfHook,
kyua,
pkg-config,
gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "atf";
version = "0.21-unstable-2021-09-01"; # Match the commit used in FreeBSD’s port.

src = fetchFromGitHub {
owner = "freebsd";
repo = "atf";
rev = "55c21b2c5fb189bbdfccb2b297bfa89236502542";
hash = "sha256-u0YBPcoIBvqBVaytaO9feBaRnQygtzEPGJV0ItI1Vco=";
};

patches = [
# Fixes use after free that causes failures in Kyua’s test suite.
# https://github.com/freebsd/atf/pull/57
# https://github.com/freebsd/kyua/issues/223
(fetchpatch {
name = "fix-use-after-free.patch";
url = "https://github.com/freebsd/atf/commit/fb22f3837bcfdce5ce8b3c0e18af131bb6902a02.patch";
hash = "sha256-p4L3sxSYfMSzwKrUDlEZpoJydbaK3Hcbvn90KlPHkic=";
})
];

postPatch =
lib.optionalString finalAttrs.doInstallCheck ''
# https://github.com/freebsd/atf/issues/61
toonn marked this conversation as resolved.
Show resolved Hide resolved
substituteInPlace atf-c/check_test.c \
--replace-fail 'ATF_TP_ADD_TC(tp, build_cpp)' ""
substituteInPlace atf-c++/check_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, build_cpp);' ""
# Can’t find `c_helpers` in the work folder.
substituteInPlace test-programs/Kyuafile \
--replace-fail 'atf_test_program{name="srcdir_test"}' ""
''
# These tests fail on Darwin.
+ lib.optionalString (finalAttrs.doInstallCheck && stdenv.isDarwin) ''
substituteInPlace atf-c/detail/process_test.c \
--replace-fail 'ATF_TP_ADD_TC(tp, status_coredump);' ""
''
# This test fails on Linux.
+ lib.optionalString (finalAttrs.doInstallCheck && stdenv.isLinux) ''
substituteInPlace atf-c/detail/fs_test.c \
--replace-fail 'ATF_TP_ADD_TC(tp, eaccess);' ""
'';

strictDeps = true;

nativeBuildInputs = [ autoreconfHook ];

enableParallelBuilding = true;

makeFlags = [
# ATF isn’t compatible with C++17, which is the default on current clang and GCC.
"CXXFLAGS=-std=c++11"
];

doInstallCheck = true;

nativeInstallCheckInputs = [ kyua ];

installCheckPhase = ''
runHook preInstallCheck
HOME=$TMPDIR PATH=$out/bin:$PATH kyua test
runHook postInstallCheck
'';

passthru.updateScript = gitUpdater { rev-prefix = "atf-"; };

__structuredAttrs = true;

meta = {
description = "Libraries to write tests in C, C++, and shell";
homepage = "https://github.com/freebsd/atf/";
license = lib.licenses.bsd3;
mainProgram = "atf-sh";
maintainers = with lib.maintainers; [ reckenrode ];
platforms = lib.platforms.unix;
};
})
3 changes: 2 additions & 1 deletion pkgs/by-name/fr/frankenphp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, testers
, frankenphp
, darwin
, libiconv
, pkg-config
, makeBinaryWrapper
, runCommand
Expand Down Expand Up @@ -64,7 +65,7 @@ in buildGoModule rec {
'' + lib.optionalString stdenv.isDarwin ''
# replace hard-code homebrew path
substituteInPlace ../frankenphp.go \
--replace "-L/opt/homebrew/opt/libiconv/lib" "-L${darwin.libiconv}/lib"
--replace "-L/opt/homebrew/opt/libiconv/lib" "-L${libiconv}/lib"
'';

preFixup = ''
Expand Down
10 changes: 10 additions & 0 deletions pkgs/by-name/ky/kyua/kyua-check-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kyuaCheckPhase() {
runHook preCheck
# Kyua expects to save test results in ~/.kyua/store
HOME=$TMPDIR kyua test
runHook postCheck
}

if [ -z "${dontUseKyuaCheck-}" ] && [ -z "${checkPhase-}" ]; then
checkPhase=kyuaCheckPhase
fi
119 changes: 119 additions & 0 deletions pkgs/by-name/ky/kyua/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
lib,
stdenv,
fetchFromGitHub,
atf,
autoreconfHook,
lutok,
pkg-config,
sqlite,
gitUpdater,
}:

let
# Avoid an infinite recursion (because ATF uses Kyua for testing).
atf' = atf.overrideAttrs (_: {
doInstallCheck = false;
});
in
stdenv.mkDerivation (finalAttrs: {
pname = "kyua";
version = "0.13-unstable-2024-01-22"; # Match the commit used in FreeBSD’s port.

src = fetchFromGitHub {
owner = "freebsd";
repo = "kyua";
rev = "c85354e09ad93a902c9e8a701c042c045ec2a5b7";
hash = "sha256-fZ0WFgOTj8Gw8IT5O8DnuaNyZscKpg6B94m+l5UoZGc";
};

setupHooks = ./kyua-check-hook.sh;

postPatch =
''
# Fix a linking error on Darwin. Embedding an archive in an archive isn’t portable.
substituteInPlace cli/Makefile.am.inc \
--replace-fail 'libcli_a_LIBADD = libutils.a' "" \
--replace-fail 'CLI_LIBS = ' 'CLI_LIBS = libutils.a '
''
# These tests fail on Darwin or are unreliable.
+ lib.optionalString (finalAttrs.doInstallCheck && stdenv.isDarwin) ''
sed -i utils/process/Makefile.am.inc -e '/executor_pid_test/d'
toonn marked this conversation as resolved.
Show resolved Hide resolved
substituteInPlace utils/process/Kyuafile \
--replace-fail 'atf_test_program{name="executor_pid_test"}' ""
substituteInPlace engine/atf_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, test__body_only__crashes);' ""
substituteInPlace engine/scheduler_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, integration__stacktrace);' ""
substituteInPlace utils/stacktrace_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, unlimit_core_size);' ""
substituteInPlace utils/process/isolation_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, isolate_child__enable_core_dumps);' ""
substituteInPlace utils/process/operations_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, terminate_self_with__termsig_and_core);' ""
substituteInPlace utils/process/status_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, integration__coredump);' ""
substituteInPlace integration/cmd_test_test.sh \
--replace-fail 'atf_add_test_case premature_exit' ""
''
# fchflags and UF_NOUNLINK are not supported on Linux. Other tests also fail.
+ lib.optionalString (finalAttrs.doInstallCheck && stdenv.isLinux) ''
sed -i utils/process/Makefile.am.inc -e '/executor_pid_test/d'
substituteInPlace utils/process/Kyuafile \
--replace-fail 'atf_test_program{name="executor_pid_test"}' ""
substituteInPlace engine/atf_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, test__body_only__crashes);' ""
substituteInPlace utils/stacktrace_test.cpp \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, dump_stacktrace__ok);' "" \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, dump_stacktrace_if_available__append);' "" \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, find_core__found__long);' "" \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, find_core__found__short);' "" \
--replace-fail 'ATF_ADD_TEST_CASE(tcs, unlimit_core_size__hard_is_zero);' ""
substituteInPlace integration/cmd_test_test.sh \
--replace-fail 'atf_add_test_case premature_exit' ""
'';

strictDeps = true;

buildInputs = [
lutok
sqlite
];

nativeBuildInputs = [
atf'
autoreconfHook
pkg-config
];

enableParallelBuilding = true;

makeFlags = [
# Kyua isn’t compatible with C++17, which is the default on current clang and GCC.
"CXXFLAGS=-std=c++11"
];

doInstallCheck = true;

installCheckInputs = [ atf' ];
nativeInstallCheckInputs = [ sqlite ];

installCheckPhase = ''
runHook preInstallCheck
HOME=$TMPDIR PATH=$out/bin:$PATH kyua test
runHook postInstallCheck
'';

passthru.updateScript = gitUpdater { rev-prefix = "kyua-"; };

__structuredAttrs = true;

meta = {
description = "Testing framework for infrastructure software";
homepage = "https://github.com/freebsd/kyua/";
license = lib.licenses.bsd3;
mainProgram = "kyua";
maintainers = with lib.maintainers; [ reckenrode ];
platforms = lib.platforms.unix;
};
})
Loading