2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, unzip
|
2018-10-12 20:21:26 +00:00
|
|
|
, gnumake, gcc-arm-embedded, binutils-arm-embedded
|
|
|
|
, dfu-util-axoloti, jdk, ant, libfaketime }:
|
2017-10-04 15:11:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-10-01 10:08:01 +00:00
|
|
|
version = "1.0.12-2";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "axoloti";
|
2017-10-04 15:11:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "axoloti";
|
|
|
|
repo = "axoloti";
|
2019-09-08 23:38:31 +00:00
|
|
|
rev = version;
|
2018-10-01 10:08:01 +00:00
|
|
|
sha256 = "1qffis277wshldr3i939b0r2x3a2mlr53samxqmr2nk1sfm2b4w9";
|
2017-10-04 15:11:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
chibi_version = "2.6.9";
|
|
|
|
chibi_name = "ChibiOS_${chibi_version}";
|
|
|
|
|
|
|
|
chibios = fetchurl {
|
|
|
|
url = "mirror://sourceforge/project/chibios/ChibiOS_RT%20stable/Version%20${chibi_version}/${chibi_name}.zip";
|
|
|
|
sha256 = "0lb5s8pkj80mqhsy47mmq0lqk34s2a2m3xagzihalvabwd0frhlj";
|
|
|
|
};
|
|
|
|
|
2018-10-29 19:38:11 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
unzip
|
|
|
|
gcc-arm-embedded
|
|
|
|
binutils-arm-embedded
|
|
|
|
dfu-util-axoloti
|
|
|
|
ant
|
|
|
|
];
|
|
|
|
buildInputs = [jdk libfaketime ];
|
2017-10-04 15:11:52 +00:00
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
unzip ${chibios}
|
|
|
|
mv ${chibi_name} chibios
|
|
|
|
(cd chibios/ext; unzip -q -o fatfs-0.9-patched.zip)
|
|
|
|
|
|
|
|
# Remove source of non-determinism in ChibiOS
|
|
|
|
substituteInPlace "chibios/os/various/shell.c" \
|
|
|
|
--replace "#ifdef __DATE__" "#if 0"
|
|
|
|
|
|
|
|
# Hardcode path to "make"
|
|
|
|
for f in "firmware/compile_firmware_linux.sh" \
|
|
|
|
"firmware/compile_patch_linux.sh"; do
|
|
|
|
substituteInPlace "$f" \
|
|
|
|
--replace "make" "${gnumake}/bin/make"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Hardcode dfu-util path
|
|
|
|
substituteInPlace "platform_linux/upload_fw_dfu.sh" \
|
|
|
|
--replace "/bin/dfu-util" ""
|
|
|
|
substituteInPlace "platform_linux/upload_fw_dfu.sh" \
|
|
|
|
--replace "./dfu-util" "${dfu-util-axoloti}/bin/dfu-util"
|
|
|
|
|
|
|
|
# Fix build version
|
|
|
|
substituteInPlace "build.xml" \
|
|
|
|
--replace "(git missing)" "${version}"
|
|
|
|
|
|
|
|
# Remove build time
|
|
|
|
substituteInPlace "build.xml" \
|
|
|
|
--replace "<tstamp>" ""
|
|
|
|
substituteInPlace "build.xml" \
|
|
|
|
--replace \
|
|
|
|
'<format property="build.time" pattern="dd/MM/yyyy HH:mm:ss z"/>' \
|
|
|
|
'<property name="build.time" value=""/>'
|
|
|
|
substituteInPlace "build.xml" \
|
|
|
|
--replace "</tstamp>" ""
|
|
|
|
substituteInPlace "build.xml" \
|
|
|
|
--replace \
|
|
|
|
'{line.separator}</echo>' \
|
|
|
|
'{line.separator}</echo> <touch file="src/main/java/axoloti/Version.java" millis="0" />'
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
find . -exec touch -d '1970-01-01 00:00' {} \;
|
|
|
|
(cd platform_linux; sh compile_firmware.sh)
|
|
|
|
faketime "1970-01-01 00:00:00" ant -Dbuild.runtime=true
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/share/axoloti
|
|
|
|
|
|
|
|
cp -r doc firmware chibios platform_linux CMSIS *.txt $out/share/axoloti/
|
|
|
|
install -vD dist/Axoloti.jar $out/share/axoloti/
|
|
|
|
|
|
|
|
makeWrapper ${jdk}/bin/java $out/bin/axoloti --add-flags "-Daxoloti_release=$out/share/axoloti -Daxoloti_runtime=$out/share/axoloti -jar $out/share/axoloti/Axoloti.jar"
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.axoloti.com";
|
2017-10-04 15:11:52 +00:00
|
|
|
description = ''
|
|
|
|
Sketching embedded digital audio algorithms.
|
|
|
|
|
|
|
|
To fix permissions of the Axoloti USB device node, add a similar udev rule to <literal>services.udev.extraRules</literal>:
|
|
|
|
<literal>SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="0442", OWNER="someuser", GROUP="somegroup"</literal>
|
|
|
|
'';
|
|
|
|
license = licenses.gpl3;
|
2018-10-01 10:07:38 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2017-10-04 15:11:52 +00:00
|
|
|
};
|
|
|
|
}
|