3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/science/misc/openmodelica/omlibrary/fakegit.nix
Vladimir Korolev 5c8561f11a openmodelica: 1.9.3 -> 1.17.0 with lots of changes
Co-authored-by: Jaakko Luttinen <jaakko.luttinen@iki.fi>

Most of changes are:
* separate packages for different openmodelica components,
* qt4 -> qt5,
* patches to instruct the OMEdit wrapper with stdenv executables
  location,
* adoption of #89731 and #109595,
* openblas -> blas, lapack according to #83888,
* parallel building,
* getting rid of spurious build phases,
* correct the license,
* cross-compilation,
* forcing compiler to clang++ according to OM build recommendations,
* drop of pangox_compat according to #75909 and #76412,
* better dependencies, and more.
2021-07-24 20:29:26 +03:00

50 lines
1 KiB
Nix

{ lib, stdenv, fetchgit, bash }:
let
mkscript = path: text: ''
mkdir -pv `dirname ${path}`
cat > ${path} <<"EOF"
#!${bash}/bin/bash
ME=$(basename ${path})
${text}
EOF
sed -i "s@%out@$out@g" ${path}
chmod +x ${path}
'';
hashname = r:
let
rpl = lib.replaceChars [ ":" "/" ] [ "_" "_" ];
in
(rpl r.url) + "-" + (rpl r.rev);
in
stdenv.mkDerivation {
name = "fakegit";
buildCommand = ''
mkdir -pv $out/repos
${lib.concatMapStrings
(r: "cp -r ${fetchgit r} $out/repos/${hashname r}\n")
(import ./src-libs.nix)}
${mkscript "$out/bin/checkout-git.sh" ''
if test "$#" -ne 4; then
echo "Usage: $0 DESTINATION URL GITBRANCH HASH"
exit 1
fi
DEST=$1
URL=`echo $2 | tr :/ __`
GITBRANCH=$3
REVISION=$4
REVISION=`echo $REVISION | tr :/ __`
rm -rf $DEST
mkdir -pv $DEST
echo "FAKEGIT cp -r %out/repos/$URL-$REVISION $DEST" >&2
cp -r %out/repos/$URL-$REVISION/* $DEST
chmod u+w -R $DEST
''}
'';
}