forked from mirrors/nixpkgs
fpc: support darwin
This commit is contained in:
parent
712fd552d6
commit
0aaca0a620
17
pkgs/development/compilers/fpc/binary-builder-darwin.sh
Executable file
17
pkgs/development/compilers/fpc/binary-builder-darwin.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
source $stdenv/setup
|
||||
|
||||
pkgdir=$(pwd)/pkg
|
||||
deploydir=$(pwd)/deploy
|
||||
|
||||
undmg $src
|
||||
mkdir $out
|
||||
mkdir $pkgdir
|
||||
mkdir $deploydir
|
||||
|
||||
pkg=*.mpkg/Contents/Packages/*.pkg
|
||||
xar -xf $pkg -C $pkgdir
|
||||
pushd $deploydir
|
||||
cat $pkgdir/Payload | gunzip -dc | cpio -i
|
||||
popd
|
||||
echo $deploydir
|
||||
cp -r $deploydir/usr/local/* $out
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, fetchurl }:
|
||||
{ stdenv, fetchurl, undmg, cpio, xar, lib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "fpc-binary";
|
||||
|
@ -20,9 +20,26 @@ stdenv.mkDerivation rec {
|
|||
url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.aarch64-linux.tar";
|
||||
sha256 = "b39470f9b6b5b82f50fc8680a5da37d2834f2129c65c24c5628a80894d565451";
|
||||
}
|
||||
else if stdenv.isDarwin then
|
||||
fetchurl {
|
||||
url = "mirror://sourceforge/project/freepascal/Mac%20OS%20X/${version}/fpc-${version}.intelarm64-macosx.dmg";
|
||||
sha256 = "05d4510c8c887e3c68de20272abf62171aa5b2ef1eba6bce25e4c0bc41ba8b7d";
|
||||
}
|
||||
else throw "Not supported on ${stdenv.hostPlatform.system}.";
|
||||
|
||||
builder = ./binary-builder.sh;
|
||||
|
||||
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
undmg
|
||||
xar
|
||||
cpio
|
||||
];
|
||||
|
||||
builder =
|
||||
if stdenv.hostPlatform.isLinux then
|
||||
./binary-builder.sh
|
||||
else if stdenv.hostPlatform.isDarwin then
|
||||
./binary-builder-darwin.sh
|
||||
else throw "Not supported on ${stdenv.hostPlatform}.";
|
||||
|
||||
meta = {
|
||||
description = "Free Pascal Compiler from a binary distribution";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, stdenv, fetchurl, gawk, fetchpatch }:
|
||||
{ lib, stdenv, fetchurl, gawk, fetchpatch, undmg, cpio, xar, darwin, libiconv }:
|
||||
|
||||
let startFPC = import ./binary.nix { inherit stdenv fetchurl; }; in
|
||||
let startFPC = import ./binary.nix { inherit stdenv fetchurl undmg cpio xar lib; }; in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "3.2.2";
|
||||
|
@ -11,7 +11,12 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "85ef993043bb83f999e2212f1bca766eb71f6f973d362e2290475dbaaf50161f";
|
||||
};
|
||||
|
||||
buildInputs = [ startFPC gawk ];
|
||||
buildInputs = [ startFPC gawk ]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
libiconv
|
||||
darwin.apple_sdk.frameworks.CoreFoundation
|
||||
];
|
||||
|
||||
glibc = stdenv.cc.libc.out;
|
||||
|
||||
# Patch paths for linux systems. Other platforms will need their own patches.
|
||||
|
@ -29,8 +34,18 @@ stdenv.mkDerivation rec {
|
|||
# substitute the markers set by the mark-paths patch
|
||||
substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by dynlinker-prefix "${glibc}"
|
||||
substituteInPlace fpcsrc/compiler/systems/t_linux.pas --subst-var-by syslibpath "${glibc}/lib"
|
||||
# Replace the `codesign --remove-signature` command with a custom script, since `codesign` is not available
|
||||
# in nixpkgs
|
||||
substituteInPlace fpcsrc/compiler/Makefile \
|
||||
--replace \
|
||||
"\$(CODESIGN) --remove-signature" \
|
||||
"${./remove-signature.sh}" \
|
||||
--replace "ifneq (\$(CODESIGN),)" "ifeq (\$(OS_TARGET), darwin)"
|
||||
'';
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString
|
||||
stdenv.isDarwin (with darwin.apple_sdk.frameworks; "-F${CoreFoundation}/Library/Frameworks");
|
||||
|
||||
makeFlags = [ "NOGDB=1" "FPC=${startFPC}/bin/fpc" ];
|
||||
|
||||
installFlags = [ "INSTALL_PREFIX=\${out}" ];
|
||||
|
@ -41,6 +56,11 @@ stdenv.mkDerivation rec {
|
|||
done
|
||||
mkdir -p $out/lib/fpc/etc/
|
||||
$out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/lib/fpc/etc/
|
||||
|
||||
# Generate config files in /etc since on darwin, ppc* does not follow symlinks
|
||||
# to resolve the location of /etc
|
||||
mkdir -p $out/etc
|
||||
$out/lib/fpc/*/samplecfg $out/lib/fpc/${version} $out/etc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
|
@ -52,6 +72,6 @@ stdenv.mkDerivation rec {
|
|||
homepage = "https://www.freepascal.org";
|
||||
maintainers = [ maintainers.raskin ];
|
||||
license = with licenses; [ gpl2 lgpl2 ];
|
||||
platforms = platforms.linux;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
|
|
3
pkgs/development/compilers/fpc/remove-signature.sh
Executable file
3
pkgs/development/compilers/fpc/remove-signature.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
source $stdenv/setup
|
||||
|
||||
codesign_allocate -r -i "$1" -o "$1"
|
Loading…
Reference in a new issue