uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,59 @@
# Based on https://github.com/justinwoo/easy-purescript-nix/blob/master/psc-package-simple.nix
{ stdenv, lib, fetchurl, gmp, zlib, libiconv, darwin, installShellFiles }:
let
dynamic-linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
pname = "psc-package-simple";
version = "0.6.2";
src = if stdenv.isDarwin
then fetchurl {
url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/macos.tar.gz";
sha256 = "17dh3bc5b6ahfyx0pi6n9qnrhsyi83qdynnca6k1kamxwjimpcq1";
}
else fetchurl {
url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/linux64.tar.gz";
sha256 = "1zvay9q3xj6yd76w6qyb9la4jaj9zvpf4dp78xcznfqbnbhm1a54";
};
buildInputs = [ gmp zlib ];
nativeBuildInputs = [ installShellFiles ];
libPath = lib.makeLibraryPath buildInputs;
dontStrip = true;
installPhase = ''
mkdir -p $out/bin
PSC_PACKAGE=$out/bin/psc-package
install -D -m555 -T psc-package $PSC_PACKAGE
chmod u+w $PSC_PACKAGE
'' + lib.optionalString stdenv.isDarwin ''
install_name_tool \
-change /usr/lib/libSystem.B.dylib ${darwin.Libsystem}/lib/libSystem.B.dylib \
-change /usr/lib/libiconv.2.dylib ${libiconv}/libiconv.2.dylib \
$PSC_PACKAGE
'' + lib.optionalString (!stdenv.isDarwin) ''
patchelf --interpreter ${dynamic-linker} --set-rpath ${libPath} $PSC_PACKAGE
'' + ''
chmod u-w $PSC_PACKAGE
installShellCompletion --cmd psc-package \
--bash <($PSC_PACKAGE --bash-completion-script $PSC_PACKAGE) \
--fish <($PSC_PACKAGE --fish-completion-script $PSC_PACKAGE) \
--zsh <($PSC_PACKAGE --zsh-completion-script $PSC_PACKAGE)
'';
meta = with lib; {
description = "A package manager for PureScript based on package sets";
license = licenses.bsd3;
maintainers = with maintainers; [ Profpatsch ];
platforms = [ "x86_64-darwin" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,69 @@
{ stdenv, pkgs, fetchurl, zlib, gmp, lib }:
# from justinwoo/easy-purescript-nix
# https://github.com/justinwoo/easy-purescript-nix/blob/d383972c82620a712ead4033db14110497bc2c9c/purs.nix
let
dynamic-linker = stdenv.cc.bintools.dynamicLinker;
patchelf = libPath :
if stdenv.isDarwin
then ""
else
''
chmod u+w $PURS
patchelf --interpreter ${dynamic-linker} --set-rpath ${libPath} $PURS
chmod u-w $PURS
'';
in stdenv.mkDerivation rec {
pname = "purescript";
version = "0.15.2";
# These hashes can be updated automatically by running the ./update.sh script.
src =
if stdenv.isDarwin
then
fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos.tar.gz";
sha256 = "06fsq9ynfvfqn3ac5jxdj81lmzd6bh84p7jz5qib31h27iy5aq4h";
}
else
fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/linux64.tar.gz";
sha256 = "1p37k6briczw6gvw04idkx734ms1swgrx9sl4hi6xwvxkfp1nm0m";
};
buildInputs = [ zlib gmp ];
libPath = lib.makeLibraryPath buildInputs;
dontStrip = true;
installPhase = ''
mkdir -p $out/bin
PURS="$out/bin/purs"
install -D -m555 -T purs $PURS
${patchelf libPath}
mkdir -p $out/share/bash-completion/completions
$PURS --bash-completion-script $PURS > $out/share/bash-completion/completions/purs-completion.bash
'';
passthru = {
updateScript = ./update.sh;
tests = {
minimal-module = pkgs.callPackage ./test-minimal-module {};
};
};
meta = with lib; {
description = "A strongly-typed functional programming language that compiles to JavaScript";
homepage = "https://www.purescript.org/";
license = licenses.bsd3;
maintainers = with maintainers; [ justinwoo mbbx6spp cdepillabout ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
mainProgram = "purs";
changelog = "https://github.com/purescript/purescript/releases/tag/v${version}";
};
}

View file

@ -0,0 +1,8 @@
"use strict"
export const log = function (s) {
return function () {
console.log(s);
return {};
};
};

View file

@ -0,0 +1,9 @@
module Main where
foreign import data Effect :: Type -> Type
data Unit = Unit
foreign import log :: String -> Effect Unit
main :: Effect Unit
main = log "hello world"

View file

@ -0,0 +1,11 @@
{ runCommand, purescript, nodejs }:
runCommand "purescript-test-minimal-module" {} ''
${purescript}/bin/purs compile -o ./output ${./.}/Main.purs
echo 'import {main} from "./output/Main/index.js"; main()' > node.mjs
${nodejs}/bin/node node.mjs | grep "hello world" || (echo "did not output hello world"; exit 1)
touch $out
''

View file

@ -0,0 +1,43 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq -I nixpkgs=.
#
# This script will update the purescript derivation to the latest version.
set -eo pipefail
# This is the directory of this update.sh script.
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
purescript_derivation_file="${script_dir}/default.nix"
# This is the current revision of PureScript in Nixpkgs.
old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$purescript_derivation_file")"
# This is the latest release version of PureScript on GitHub.
new_version=$(curl --silent "https://api.github.com/repos/purescript/purescript/releases/latest" | jq '.tag_name' --raw-output | sed -e 's/v//')
echo "Updating purescript from old version v${old_version} to new version v${new_version}."
echo
echo "Fetching both old and new release tarballs for Darwin and Linux in order to confirm hashes."
echo
old_linux_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${old_version}/linux64.tar.gz")"
echo "v${old_version} linux tarball hash (current version): $old_linux_version_hash"
new_linux_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${new_version}/linux64.tar.gz")"
echo "v${new_version} linux tarball hash: $new_linux_version_hash"
old_darwin_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${old_version}/macos.tar.gz")"
echo "v${old_version} darwin tarball hash (current version): $old_darwin_version_hash"
new_darwin_version_hash="$(nix-prefetch-url "https://github.com/purescript/purescript/releases/download/v${new_version}/macos.tar.gz")"
echo "v${new_version} darwin tarball hash: $new_darwin_version_hash"
echo
echo "Replacing version and hashes in ${purescript_derivation_file}."
sed -i -e "s/${old_linux_version_hash}/${new_linux_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_darwin_version_hash}/${new_darwin_version_hash}/" "$purescript_derivation_file"
sed -i -e "s/${old_version}/${new_version}/" "$purescript_derivation_file"
echo
echo "Finished. Make sure you run the following commands to confirm PureScript builds correctly:"
echo ' - `nix build -L -f ./. purescript`'
echo ' - `nix build -L -f ./. purescript.passthru.tests.minimal-module`'
echo ' - `sudo nix build -L -f ./. spago.passthru.tests --option sandbox relaxed`'