Skip to content

Commit

Permalink
Fixed macOS build of xmake
Browse files Browse the repository at this point in the history
  • Loading branch information
HU90m committed May 20, 2024
1 parent 1065b3f commit 80dad3c
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 17 deletions.
6 changes: 2 additions & 4 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: flake.lock
pkgs/python_ot/poetry.lock
Files: *.lock
*.patch
pkgs/python_ot/poetry-git-overlay.nix
pkgs/verilator/fix.patch
README.md
**/README.md
pkgs/surfer/Cargo.lock
Copyright: lowRISC contributors
License: MIT
2 changes: 1 addition & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# CherIoT packages
spike-ibex-cosim = pkgs.callPackage ./spike.nix {};
llvm_cheriot = pkgs.callPackage ./llvm_cheriot.nix {};
xmake = import ./xmake.nix {inherit pkgs;};
xmake = pkgs.callPackage ./xmake {};
cheriot-sim = pkgs.callPackage ./cheriot-sim.nix {};

container-hotplug = pkgs.callPackage ./container-hotplug {};
Expand Down
12 changes: 0 additions & 12 deletions pkgs/xmake.nix

This file was deleted.

49 changes: 49 additions & 0 deletions pkgs/xmake/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright lowRISC Contributors.
# SPDX-License-Identifier: MIT
{
lib,
stdenv,
fetchurl,
pkg-config,
lua,
readline,
ncurses,
lz4,
darwin,
}:
stdenv.mkDerivation rec {
pname = "xmake";
version = "2.9.1";

src = fetchurl {
url = "https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.tar.gz";
hash = "sha256-ox2++MMDrqEmgGi0sawa7BQqxBJMfLfZx+61fEFPjRU=";
};

# This patch is needed because, when building with Nix,
# coreutils' and findutils' versions of date and find are provided,
# which have slightly different behaviour to the macOS versions.
patches = [./macosx.patch];

nativeBuildInputs = [
pkg-config
];

buildInputs =
[
lua
readline
ncurses
lz4
]
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreServices;

strictDeps = true;

meta = with lib; {
description = "A cross-platform build utility based on Lua";
homepage = "https://xmake.io";
license = licenses.asl20;
platforms = lua.meta.platforms;
};
}
26 changes: 26 additions & 0 deletions pkgs/xmake/macosx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/configure b/configure
index 9f4232d50..96cee6ae7 100755
--- a/configure
+++ b/configure
@@ -242,11 +242,7 @@ _os_find() {
local name="${2}"
local depth="${3}"
if test_nz "${depth}"; then
- if is_host "macosx"; then
- _ret=$(find "${dir}" -depth "${depth}" -type f -name "${name}")
- else
- _ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}")
- fi
+ _ret=$(find "${dir}" -maxdepth "${depth}" -mindepth "${depth}" -type f -name "${name}")
else
_ret=$(find "${dir}" -type f -name "${name}")
fi
@@ -258,8 +254,6 @@ _os_find() {
_os_date() {
if test_z "${SOURCE_DATE_EPOCH}"; then
_ret=$(date +"${1}")
- elif is_host "macosx" "freebsd" "bsd"; then
- _ret=$(date -u -r "$SOURCE_DATE_EPOCH" +"${1}")
else
_ret=$(date -u -d "@$SOURCE_DATE_EPOCH" +"${1}")
fi

0 comments on commit 80dad3c

Please sign in to comment.