From a426aa3a3fbfdcf56f4acfd5f29d81d1594cc8e6 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 31 Mar 2024 09:57:54 -0400 Subject: [PATCH] Revert "darwin.libiconv: remove and add to darwin-aliases" This reverts commit 521ea079b9e39d6bd66a919cb3449493d975ab6d. --- pkgs/applications/editors/vim/macvim.nix | 3 +- pkgs/by-name/fr/frankenphp/package.nix | 3 +- .../json-stream-rs-tokenizer/default.nix | 4 +- .../darwin/apple-source-releases/default.nix | 3 ++ .../libiconv/default.nix | 38 +++++++++++++++++++ .../apple-source-releases/macos-11.0.1.nix | 1 + pkgs/top-level/darwin-aliases.nix | 4 -- pkgs/top-level/python-packages.nix | 6 ++- 8 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 64aa5b639a9b..ce83128e98b1 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -11,7 +11,6 @@ , perl , luajit , darwin -, libiconv , python3 }: @@ -128,7 +127,7 @@ stdenv.mkDerivation { --replace " -L${stdenv.cc.libc}/lib" "" \ --replace " -L${darwin.libobjc}/lib" "" \ --replace " -L${darwin.libunwind}/lib" "" \ - --replace " -L${libiconv}/lib" "" + --replace " -L${darwin.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. diff --git a/pkgs/by-name/fr/frankenphp/package.nix b/pkgs/by-name/fr/frankenphp/package.nix index 27ee46f0cbaa..e6ce4c97d2b0 100644 --- a/pkgs/by-name/fr/frankenphp/package.nix +++ b/pkgs/by-name/fr/frankenphp/package.nix @@ -7,7 +7,6 @@ , testers , frankenphp , darwin -, libiconv , pkg-config , makeBinaryWrapper , runCommand @@ -65,7 +64,7 @@ in buildGoModule rec { '' + lib.optionalString stdenv.isDarwin '' # replace hard-code homebrew path substituteInPlace ../frankenphp.go \ - --replace "-L/opt/homebrew/opt/libiconv/lib" "-L${libiconv}/lib" + --replace "-L/opt/homebrew/opt/libiconv/lib" "-L${darwin.libiconv}/lib" ''; preFixup = '' diff --git a/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix b/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix index ce2a48bae9c8..9609d68c6961 100644 --- a/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix +++ b/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix @@ -2,7 +2,7 @@ , stdenv , buildPythonPackage , cargo -, libiconv +, darwin , fetchFromGitHub , json-stream , json-stream-rs-tokenizer @@ -45,7 +45,7 @@ buildPythonPackage rec { ]; buildInputs = lib.optionals stdenv.isDarwin [ - libiconv + darwin.libiconv ]; # Tests depend on json-stream, which depends on this package. diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 3783b7c8a5c4..8a562cc82558 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -11,6 +11,7 @@ let }; "osx-10.12.6" = { xnu = "3789.70.16"; + libiconv = "50"; Libnotify = "165.20.1"; objc4 = "709.1"; dyld = "433.5"; @@ -37,6 +38,7 @@ let dtrace = "168"; xnu = "3248.60.10"; libpthread = "138.10.4"; + libiconv = "44"; Libnotify = "150.40.1"; objc4 = "680"; eap8021x = "222.40.1"; @@ -270,6 +272,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { }; libclosure = applePackage "libclosure" "osx-10.11.6" "sha256-L5rQ+UBpf3B+W1U+gZKk7fXulslHsc8lxnCsplV+nr0=" {}; libdispatch = applePackage "libdispatch" "osx-10.10.5" "sha256-jfAEk0OLrJa9AIZVikIoHomd+l+4rCfc320Xh50qK5M=" {}; + libiconv = applePackage "libiconv" "osx-10.12.6" "sha256-ZzPFkchK3EU95UQUVVrR0t8iilhi/VnIkjjtP6KT2oI=" {}; Libinfo = applePackage "Libinfo" "osx-10.11.6" "sha256-6F7wiwerv4nz/xXHtp1qCHSaFzZgzcRN+jbmXA5oWOQ=" {}; Libm = applePackage "Libm" "osx-10.7.4" "sha256-KjMETfT4qJm0m0Ux/F6Rq8bI4Q4UVnFx6IKbKxXd+Es=" {}; Libnotify = applePackage "Libnotify" "osx-10.12.6" "sha256-6wvMBxAUfiYcQtmlfYCj1d3kFmFM/jdboTd7hRvi3e4=" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix new file mode 100644 index 000000000000..6a3bddc211e9 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix @@ -0,0 +1,38 @@ +{ stdenv, appleDerivation, lib +, enableStatic ? stdenv.hostPlatform.isStatic +, enableShared ? !stdenv.hostPlatform.isStatic +}: + +appleDerivation { + postUnpack = "sourceRoot=$sourceRoot/libiconv"; + + preConfigure = lib.optionalString stdenv.hostPlatform.isiOS '' + sed -i 's/darwin\*/ios\*/g' configure libcharset/configure + ''; + + configureFlags = [ + (lib.enableFeature enableStatic "static") + (lib.enableFeature enableShared "shared") + ]; + + postInstall = lib.optionalString enableShared '' + mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib + ${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib + + # re-export one useless symbol; ld will reject a dylib that only reexports other dylibs + echo 'void dont_use_this(){}' | ${stdenv.cc.bintools.targetPrefix}clang -dynamiclib -x c - -current_version 2.4.0 \ + -compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \ + -Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \ + -Wl,-reexport_library -Wl,$out/lib/libcharset.dylib + ''; + + setupHooks = [ + ../../../../build-support/setup-hooks/role.bash + ../../../../development/libraries/libiconv/setup-hook.sh + ]; + + meta = { + mainProgram = "iconv"; + platforms = lib.platforms.darwin; + }; +} diff --git a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix index 2de90a023676..b4a7bbc4df24 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/macos-11.0.1.nix @@ -27,6 +27,7 @@ file_cmds = applePackage' "file_cmds" "321.40.3" "macos-11.0.1" "0p077lnbcy8266m hfs = applePackage' "hfs" "556.41.1" "macos-11.0.1" "0a0s6b12b0q07wslfifna0bj51dml9v098i4crr2m1vivnx4xj75" {}; libclosure = applePackage' "libclosure" "78" "macos-11.0.1" "0vf9n0k3m8dbprv1bf45zqg0g43bidy2i5z1v9a826bsf8lv7am7" {}; libdispatch = applePackage' "libdispatch" "1271.40.12" "macos-11.0.1" "1ck5srcjapg18vqb8wl08gacs7ndc6xr067qjn3ngx39q1jdcywz" {}; +libiconv = applePackage' "libiconv" "59" "macos-11.0.1" "0lwa4brdwm4lvrdnxylzsn1yph4m7csgri2zkc4xb4xiisz32pwp" {}; libmalloc = applePackage' "libmalloc" "317.40.8" "macos-11.0.1" "sha256-Tdhb0mq3w4Hwvp3xHB79Vr22hCOQK6h28HCsd7jvITI=" {}; libplatform = applePackage' "libplatform" "254.40.4" "macos-11.0.1" "1qf3ri0yd8b1xjln1j1gyx7ks6k3a2jhd63blyvfby75y9s7flky" {}; libpthread = applePackage' "libpthread" "454.40.3" "macos-11.0.1" "0zljbw8mpb80n1if65hhi9lkgwbgjr8vc9wvf7q1nl3mzyl35f8p" {}; diff --git a/pkgs/top-level/darwin-aliases.nix b/pkgs/top-level/darwin-aliases.nix index 694389f08238..2466cae23ed8 100644 --- a/pkgs/top-level/darwin-aliases.nix +++ b/pkgs/top-level/darwin-aliases.nix @@ -50,8 +50,4 @@ mapAliases ({ ### B ### builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06 - - ### L ### - - libiconv = pkgs.libiconv; # 2024-03-27 }) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c15b9f68816e..09f13555645a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2517,6 +2517,7 @@ self: super: with self; { cryptodatahub = callPackage ../development/python-modules/cryptodatahub { }; cryptography = callPackage ../development/python-modules/cryptography { + inherit (pkgs.darwin) libiconv; inherit (pkgs.darwin.apple_sdk.frameworks) Security; }; @@ -2541,6 +2542,7 @@ self: super: with self; { css-html-js-minify = callPackage ../development/python-modules/css-html-js-minify { }; css-inline = callPackage ../development/python-modules/css-inline { + inherit (pkgs.darwin) libiconv; inherit (pkgs.darwin.apple_sdk.frameworks) Security SystemConfiguration; }; @@ -11477,7 +11479,9 @@ self: super: with self; { pyreaderwriterlock = callPackage ../development/python-modules/pyreaderwriterlock { }; - pyreadstat = callPackage ../development/python-modules/pyreadstat { }; + pyreadstat = callPackage ../development/python-modules/pyreadstat { + inherit (pkgs.darwin) libiconv; + }; pyrealsense2 = toPythonModule (pkgs.librealsense.override { enablePython = true;