···134 inherit llvm_meta;
135 };
136137- lldb = callPackage ./lldb {
138- inherit llvm_meta;
139- inherit (darwin) libobjc bootstrap_cmds;
140- inherit (darwin.apple_sdk.libs) xpc;
141- inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa;
0000000000000000000000000142 };
143144 # Below, is the LLVM bootstrapping logic. It handles building a
···134 inherit llvm_meta;
135 };
136137+ lldb = callPackage ../common/lldb.nix {
138+ patches =
139+ let
140+ resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch"
141+ {
142+ clangLibDir = "${libclang.lib}/lib";
143+ } ''
144+ substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir
145+ '')) { };
146+ in
147+ [
148+ ./lldb/procfs.patch
149+ resourceDirPatch
150+ ./lldb/gnu-install-dirs.patch
151+ ]
152+ # This is a stopgap solution if/until the macOS SDK used for x86_64 is
153+ # updated.
154+ #
155+ # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
156+ # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
157+ # of this preprocessor symbol in `lldb` with its expansion.
158+ #
159+ # See here for some context:
160+ # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
161+ ++ lib.optional (
162+ stdenv.targetPlatform.isDarwin
163+ && !stdenv.targetPlatform.isAarch64
164+ && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
165+ ) ./lldb/cpu_subtype_arm64e_replacement.patch;
166+ inherit llvm_meta release_version;
167 };
168169 # Below, is the LLVM bootstrapping logic. It handles building a
···135 inherit llvm_meta;
136 };
137138- lldb = callPackage ./lldb {
139- inherit llvm_meta;
140- inherit (darwin) libobjc bootstrap_cmds;
141- inherit (darwin.apple_sdk.libs) xpc;
142- inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa;
0000000000000000000000000143 };
144145 # Below, is the LLVM bootstrapping logic. It handles building a
···135 inherit llvm_meta;
136 };
137138+ lldb = callPackage ../common/lldb.nix {
139+ patches =
140+ let
141+ resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch"
142+ {
143+ clangLibDir = "${libclang.lib}/lib";
144+ } ''
145+ substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir
146+ '')) { };
147+ in
148+ [
149+ ./lldb/procfs.patch
150+ resourceDirPatch
151+ ./lldb/gnu-install-dirs.patch
152+ ]
153+ # This is a stopgap solution if/until the macOS SDK used for x86_64 is
154+ # updated.
155+ #
156+ # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
157+ # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
158+ # of this preprocessor symbol in `lldb` with its expansion.
159+ #
160+ # See here for some context:
161+ # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
162+ ++ lib.optional (
163+ stdenv.targetPlatform.isDarwin
164+ && !stdenv.targetPlatform.isAarch64
165+ && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
166+ ) ./lldb/cpu_subtype_arm64e_replacement.patch;
167+ inherit llvm_meta release_version;
168 };
169170 # Below, is the LLVM bootstrapping logic. It handles building a
···183 inherit llvm_meta;
184 };
185186- lldb = callPackage ./lldb {
187- inherit llvm_meta;
188- inherit (darwin) libobjc bootstrap_cmds;
189- inherit (darwin.apple_sdk.libs) xpc;
190- inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa;
0000000000000000000000000191 };
192193 # Below, is the LLVM bootstrapping logic. It handles building a
···183 inherit llvm_meta;
184 };
185186+ lldb = callPackage ../common/lldb.nix {
187+ patches =
188+ let
189+ resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch"
190+ {
191+ clangLibDir = "${libclang.lib}/lib";
192+ } ''
193+ substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir
194+ '')) { };
195+ in
196+ [
197+ ./lldb/procfs.patch
198+ resourceDirPatch
199+ ./lldb/gnu-install-dirs.patch
200+ ]
201+ # This is a stopgap solution if/until the macOS SDK used for x86_64 is
202+ # updated.
203+ #
204+ # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
205+ # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
206+ # of this preprocessor symbol in `lldb` with its expansion.
207+ #
208+ # See here for some context:
209+ # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
210+ ++ lib.optional (
211+ stdenv.targetPlatform.isDarwin
212+ && !stdenv.targetPlatform.isAarch64
213+ && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
214+ ) ./lldb/cpu_subtype_arm64e_replacement.patch;
215+ inherit llvm_meta release_version;
216 };
217218 # Below, is the LLVM bootstrapping logic. It handles building a
···184 inherit llvm_meta;
185 };
186187- lldb = callPackage ./lldb {
188- inherit llvm_meta;
189- inherit (darwin) libobjc bootstrap_cmds;
190- inherit (darwin.apple_sdk.libs) xpc;
191- inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa;
000000000000000000000000000000192 };
193194 # Below, is the LLVM bootstrapping logic. It handles building a
···184 inherit llvm_meta;
185 };
186187+ lldb = callPackage ../common/lldb.nix {
188+ src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
189+ mkdir -p "$out"
190+ cp -r ${monorepoSrc}/cmake "$out"
191+ cp -r ${monorepoSrc}/lldb "$out"
192+ '') { };
193+ patches =
194+ let
195+ resourceDirPatch = callPackage ({ runCommand, libclang }: (runCommand "resource-dir.patch"
196+ {
197+ clangLibDir = "${libclang.lib}/lib";
198+ } ''
199+ substitute '${./lldb/resource-dir.patch}' "$out" --subst-var clangLibDir
200+ '')) { };
201+ in
202+ [
203+ # FIXME: do we need this? ./procfs.patch
204+ resourceDirPatch
205+ ./lldb/gnu-install-dirs.patch
206+ ]
207+ # This is a stopgap solution if/until the macOS SDK used for x86_64 is
208+ # updated.
209+ #
210+ # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
211+ # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
212+ # of this preprocessor symbol in `lldb` with its expansion.
213+ #
214+ # See here for some context:
215+ # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
216+ ++ lib.optional (
217+ stdenv.targetPlatform.isDarwin
218+ && !stdenv.targetPlatform.isAarch64
219+ && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
220+ ) ./lldb/cpu_subtype_arm64e_replacement.patch;
221+ inherit llvm_meta release_version;
222 };
223224 # Below, is the LLVM bootstrapping logic. It handles building a