mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 02:55:39 +00:00
arduino: 1.0.6 -> 1.6.6
This commit is contained in:
parent
135fe56183
commit
6ff886e539
@ -1,45 +1,51 @@
|
|||||||
{ stdenv, fetchFromGitHub, jdk, jre, ant, coreutils, gnugrep, file, libusb
|
{ stdenv, fetchFromGitHub, jdk, jre, ant, coreutils, gnugrep, file, libusb
|
||||||
, withGui ? false, gtk2 ? null
|
, unzip, zlib, readline, ncurses, withGui ? false, gtk2 ? null }:
|
||||||
}:
|
|
||||||
|
|
||||||
assert withGui -> gtk2 != null;
|
assert withGui -> gtk2 != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
version = "1.0.6";
|
version = "1.6.6";
|
||||||
name = "arduino${stdenv.lib.optionalString (withGui == false) "-core"}-${version}";
|
name = "arduino${stdenv.lib.optionalString (withGui == false) "-core"}-${version}";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "arduino";
|
owner = "arduino";
|
||||||
repo = "Arduino";
|
repo = "Arduino";
|
||||||
rev = "${version}";
|
rev = "${version}";
|
||||||
sha256 = "0nr5b719qi03rcmx6swbhccv6kihxz3b8b6y46bc2j348rja5332";
|
sha256 = "1gm3sjjs149r2d82ynx25qlg31bbird1zr4x01qi4ybk3gp0268v";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ jdk ant file ];
|
buildInputs = [ jdk ant file unzip ];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
cd ./core && ant
|
cd ./arduino-core && ant
|
||||||
cd ../build && ant
|
cd ../build && ant
|
||||||
cd ..
|
cd ..
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
libPath = stdenv.lib.makeLibraryPath (builtins.filter (l: l != null) [
|
||||||
|
gtk2 stdenv.cc.cc zlib readline libusb ncurses]) + ":$out/lib";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share/arduino
|
mkdir -p $out/share/arduino
|
||||||
cp -r ./build/linux/work/* "$out/share/arduino/"
|
cp -r ./build/linux/work/* "$out/share/arduino/"
|
||||||
echo ${version} > $out/share/arduino/lib/version.txt
|
echo ${version} > $out/share/arduino/lib/version.txt
|
||||||
|
|
||||||
|
# Hack around lack of libtinfo in NixOS
|
||||||
|
mkdir -p $out/lib
|
||||||
|
ln -s ${ncurses.out}/lib/libncursesw.so.5 $out/lib/libtinfo.so.5
|
||||||
|
|
||||||
${stdenv.lib.optionalString withGui ''
|
${stdenv.lib.optionalString withGui ''
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
sed -i -e "s|^java|${jdk}/bin/java|" "$out/share/arduino/arduino"
|
sed -i -e "s|^JAVA=.*|JAVA=${jdk}/bin/java|" "$out/share/arduino/arduino"
|
||||||
sed -i -e "s|^LD_LIBRARY_PATH=|LD_LIBRARY_PATH=${gtk2}/lib:|" "$out/share/arduino/arduino"
|
sed -i -e "s|^LD_LIBRARY_PATH=|LD_LIBRARY_PATH=${libPath}:|" "$out/share/arduino/arduino"
|
||||||
ln -sr "$out/share/arduino/arduino" "$out/bin/arduino"
|
ln -sr "$out/share/arduino/arduino" "$out/bin/arduino"
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# Fixup "/lib64/ld-linux-x86-64.so.2" like references in ELF executables.
|
# Fixup "/lib64/ld-linux-x86-64.so.2" like references in ELF executables.
|
||||||
echo "running patchelf on prebuilt binaries:"
|
echo "running patchelf on prebuilt binaries:"
|
||||||
find "$out" | while read filepath; do
|
find "$out" | while read filepath; do
|
||||||
if file "$filepath" | grep -q "ELF.*executable"; then
|
if file "$filepath" | grep -q "ELF.*executable.*dynamic"; then
|
||||||
# skip target firmware files
|
# skip target firmware files
|
||||||
if echo "$filepath" | grep -q "\.elf$"; then
|
if echo "$filepath" | grep -q "\.elf$"; then
|
||||||
continue
|
continue
|
||||||
@ -50,8 +56,8 @@ stdenv.mkDerivation rec {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ libusb ]} \
|
patchelf --set-rpath ${libPath} \
|
||||||
"$out/share/arduino/hardware/tools/avrdude"
|
"$out/share/arduino/hardware/tools/avr/bin/avrdude_bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user