@@ -1,4 +1,4 @@
1−{ stdenv, buildEnv, writeText, writeScriptBin, pkgs, pkgsi686Linux }:
1+{ stdenv, lib, buildEnv, writeText, writeScriptBin, pkgs, pkgsi686Linux }:
22
33{ name, profile ? ""
44, targetPkgs ? pkgs: [], multiPkgs ? pkgs: []
@@ -138,7 +138,20 @@ let
138138 mkdir -m0755 usr
139139 cd usr
140140 ${setupLibDirs}
141− for i in bin sbin share include; do
141+ ${lib.optionalString isMultiBuild ''
142+ if [ -d "${staticUsrProfileMulti}/share" ]; then
143+ cp -rLf ${staticUsrProfileMulti}/share share
144+ fi
145+ ''}
146+ if [ -d "${staticUsrProfileTarget}/share" ]; then
147+ if [ -d share ]; then
148+ chmod -R 755 share
149+ cp -rLTf ${staticUsrProfileTarget}/share share
150+ else
151+ cp -rLf ${staticUsrProfileTarget}/share share
152+ fi
153+ fi
154+ for i in bin sbin include; do
142155 if [ -d "${staticUsrProfileTarget}/$i" ]; then
143156 cp -rsHf "${staticUsrProfileTarget}/$i" "$i"
144157 fi