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:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
123
pkgs/development/compilers/open-watcom/bin.nix
Normal file
123
pkgs/development/compilers/open-watcom/bin.nix
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
{ lib, stdenvNoCC, fetchurl, qemu, expect, writeScript, writeScriptBin, ncurses, bash, coreutils }:
|
||||
|
||||
let
|
||||
|
||||
# We execute all OpenWatcom binaries in qemu-user, because otherwise
|
||||
# some binaries (most notably the installer itself and wlib) fail to
|
||||
# use the stat() systemcall. The failure mode is that it returns
|
||||
# EOVERFLOW for completely legitimate requests. This seems like an
|
||||
# incompatibility of new Linux kernels to run this ancient binary.
|
||||
wrapLegacyBinary = writeScript "wrapLegacyBinary" ''
|
||||
#!${bash}/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 unwrapped-binary wrapped-binary"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IN="$(${coreutils}/bin/realpath $1)"
|
||||
OUT="$2"
|
||||
ARGV0="$(basename $2)"
|
||||
|
||||
cat > "$OUT" <<EOF
|
||||
#!${bash}/bin/bash
|
||||
|
||||
TERMINFO=${ncurses}/share/terminfo TERM=vt100 exec ${qemu}/bin/qemu-i386 -0 $ARGV0 $IN "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x "$OUT"
|
||||
'';
|
||||
|
||||
wrapInPlace = writeScriptBin "wrapInPlace" ''
|
||||
#!${bash}/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 unwrapped-binary"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET="$1"
|
||||
|
||||
mv "$TARGET" "$TARGET-unwrapped"
|
||||
chmod +x "$TARGET-unwrapped"
|
||||
|
||||
exec ${wrapLegacyBinary} "$TARGET-unwrapped" "$TARGET"
|
||||
'';
|
||||
|
||||
# Do a scripted installation of OpenWatcom with its original installer.
|
||||
#
|
||||
# If maintaining this expect script turns out to be too much of a
|
||||
# hassle, we can switch to just using `unzip' on the installer and
|
||||
# the correct file permissions manually.
|
||||
performInstall = writeScriptBin "performInstall" ''
|
||||
#!${expect}/bin/expect -f
|
||||
|
||||
spawn [lindex $argv 0]
|
||||
|
||||
# Wait for button saying "I agree" with escape sequences.
|
||||
expect "gree"
|
||||
|
||||
# Navigate to "I Agree!" and hit enter.
|
||||
send "\t\t\n"
|
||||
|
||||
expect "Install Open Watcom"
|
||||
|
||||
# Where do we want to install to.
|
||||
send "$env(out)\n"
|
||||
|
||||
expect "will be installed"
|
||||
|
||||
# Select Full Installation, Next
|
||||
send "fn"
|
||||
|
||||
expect "Setup will now copy"
|
||||
|
||||
# Next
|
||||
send "n"
|
||||
|
||||
expect "completed successfully"
|
||||
send "\n"
|
||||
'';
|
||||
|
||||
in
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "open-watcom-bin";
|
||||
version = "1.9";
|
||||
name = "${pname}-unwrapped-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://ftp.openwatcom.org/install/open-watcom-c-linux-${version}";
|
||||
sha256 = "1wzkvc6ija0cjj5mcyjng5b7hnnc5axidz030c0jh05pgvi4nj7p";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ wrapInPlace performInstall ];
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
cp ${src} install-bin-unwrapped
|
||||
wrapInPlace install-bin-unwrapped
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
performInstall ./install-bin-unwrapped
|
||||
|
||||
for e in $(find $out/binl -type f -executable); do
|
||||
echo "Wrapping $e"
|
||||
wrapInPlace "$e"
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A C/C++ Compiler (binary distribution)";
|
||||
homepage = "http://www.openwatcom.org/";
|
||||
license = licenses.watcom;
|
||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
maintainers = [ maintainers.blitz ];
|
||||
};
|
||||
}
|
||||
123
pkgs/development/compilers/open-watcom/v2.nix
Normal file
123
pkgs/development/compilers/open-watcom/v2.nix
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, unstableGitUpdater
|
||||
, dosbox
|
||||
|
||||
# Docs cause an immense increase in build time, up to 2 additional hours
|
||||
, withDocs ? false
|
||||
, ghostscript
|
||||
, withGUI ? false
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "open-watcom-v2";
|
||||
version = "unstable-2022-05-04";
|
||||
name = "${pname}-unwrapped-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "open-watcom";
|
||||
repo = "open-watcom-v2";
|
||||
rev = "01662ab4eb50c0757969fa53bd4270dbbba45dc5";
|
||||
sha256 = "Nl5mcPDCr08XkVMWqkbbgTP/YjpfwMOo2GVu43FQQ3Y=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs *.sh
|
||||
|
||||
for dateSource in cmnvars.sh bld/wipfc/configure; do
|
||||
substituteInPlace $dateSource \
|
||||
--replace '`date ' '`date -ud "@$SOURCE_DATE_EPOCH" '
|
||||
done
|
||||
|
||||
substituteInPlace bld/watcom/h/banner.h \
|
||||
--replace '__DATE__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%b %d %Y')\"" \
|
||||
--replace '__TIME__' "\"$(date -ud "@$SOURCE_DATE_EPOCH" +'%T')\""
|
||||
|
||||
substituteInPlace build/makeinit \
|
||||
--replace '%__CYEAR__' '%OWCYEAR'
|
||||
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
||||
substituteInPlace build/mif/local.mif \
|
||||
--replace '-static' ""
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ dosbox ]
|
||||
++ lib.optional withDocs ghostscript;
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export OWROOT=$(realpath $PWD)
|
||||
export OWTOOLS=${if stdenv.cc.isClang then "CLANG" else "GCC"}
|
||||
export OWDOCBUILD=${if withDocs then "1" else "0"}
|
||||
export OWGHOSTSCRIPTPATH=${lib.optionalString withDocs "${ghostscript}/bin"}
|
||||
export OWGUINOBUILD=${if withGUI then "0" else "1"}
|
||||
export OWNOBUILD=
|
||||
export OWDISTRBUILD=0
|
||||
export OWDOSBOX=${dosbox}/bin/dosbox
|
||||
export OWVERBOSE=0
|
||||
export OWRELROOT=$out
|
||||
|
||||
source cmnvars.sh
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
./build.sh build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
./build.sh cprel
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# Stripping breaks many tools
|
||||
dontStrip = true;
|
||||
|
||||
passthru.updateScript = unstableGitUpdater {
|
||||
url = "https://github.com/open-watcom/open-watcom-v2.git";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "The v2 fork of the Open Watcom suite of compilers and tools";
|
||||
longDescription = ''
|
||||
A fork of Open Watcom: A C/C++/Fortran compiler and assembler suite
|
||||
targeting a multitude of architectures (x86, IA-32, Alpha AXP, MIPS,
|
||||
PowerPC) and operating systems (DOS, OS/2, Windows, Linux).
|
||||
|
||||
Main differences from Open Watcom 1.9:
|
||||
|
||||
- New two-phase build system - Open Watcom can be built by the host's
|
||||
native C/C++ compiler or by itself
|
||||
- Code generator properly initializes pointers by DLL symbol addresses
|
||||
- DOS tools now support long file names (LFN) if appropriate LFN driver
|
||||
is loaded by DOS
|
||||
- Open Watcom is ported to 64-bit hosts (Win64, Linux x64)
|
||||
- Librarian supports x64 CPU object modules and libraries
|
||||
- RDOS 32-bit C run-time compact memory model libraries are fixed
|
||||
- Resource compiler and Resource editors support Win64 executables
|
||||
- Open Watcom text editor is now self-contained, it can be used as
|
||||
standalone tool without any requirements for any additional files or
|
||||
configuration
|
||||
- Broken C++ compiler pre-compiled header template support is fixed
|
||||
- Many C++ compiler crashes are fixed
|
||||
- Debugger has no length limit for any used environment variable
|
||||
'' + lib.optionalString (!withDocs) ''
|
||||
|
||||
The documentation has been excluded from this build for build time reasons. It can be found here:
|
||||
https://github.com/open-watcom/open-watcom-v2/wiki/Open-Watcom-Documentation
|
||||
'';
|
||||
homepage = "https://open-watcom.github.io";
|
||||
license = licenses.watcom;
|
||||
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "x86_64-windows" "i686-windows" ];
|
||||
maintainers = with maintainers; [ OPNA2608 ];
|
||||
};
|
||||
}
|
||||
130
pkgs/development/compilers/open-watcom/wrapper.nix
Normal file
130
pkgs/development/compilers/open-watcom/wrapper.nix
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
# Arguments that this derivation gets when it is created with `callPackage`
|
||||
{ stdenv
|
||||
, lib
|
||||
, symlinkJoin
|
||||
, makeWrapper
|
||||
, runCommand
|
||||
, file
|
||||
}:
|
||||
|
||||
open-watcom:
|
||||
|
||||
let
|
||||
wrapper =
|
||||
{}:
|
||||
let
|
||||
binDirs = with stdenv.hostPlatform; if isWindows then [
|
||||
(lib.optionalString is64bit "binnt64")
|
||||
"binnt"
|
||||
(lib.optionalString is32bit "binw")
|
||||
] else if (isDarwin && is64bit) then [
|
||||
"osx64"
|
||||
] else [
|
||||
(lib.optionalString is64bit "binl64")
|
||||
"binl"
|
||||
];
|
||||
includeDirs = with stdenv.hostPlatform; [
|
||||
"h"
|
||||
]
|
||||
++ lib.optional isWindows "h/nt"
|
||||
++ lib.optional isLinux "lh";
|
||||
listToDirs = list: lib.strings.concatMapStringsSep ":" (dir: "${placeholder "out"}/${dir}") list;
|
||||
name = "${open-watcom.pname}-${open-watcom.version}";
|
||||
in
|
||||
symlinkJoin {
|
||||
inherit name;
|
||||
|
||||
paths = [ open-watcom ];
|
||||
|
||||
buildInputs = [ makeWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
mkdir $out/bin
|
||||
|
||||
for binDir in ${lib.strings.concatStringsSep " " binDirs}; do
|
||||
for exe in $(find ${open-watcom}/$binDir \
|
||||
-type f -executable \
|
||||
${lib.optionalString stdenv.hostPlatform.isLinux "-not -iname '*.so' -not -iname '*.exe'"} \
|
||||
); do
|
||||
if [ ! -f $out/bin/$(basename $exe) ]; then
|
||||
makeWrapper $exe $out/bin/$(basename $exe) \
|
||||
--set WATCOM ${open-watcom} \
|
||||
--prefix PATH : ${listToDirs binDirs} \
|
||||
--set EDPATH ${open-watcom}/eddat \
|
||||
--set INCLUDE ${listToDirs includeDirs}
|
||||
fi
|
||||
done
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
unwrapped = open-watcom;
|
||||
tests = let
|
||||
wrapped = wrapper { };
|
||||
in {
|
||||
simple = runCommand "${name}-test-simple" { nativeBuildInputs = [ wrapped ]; } ''
|
||||
cat <<EOF >test.c
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf ("Testing OpenWatcom C89 compiler.\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
cat test.c
|
||||
# Darwin target not supported, only host
|
||||
wcl386 -fe=test_c test.c
|
||||
${lib.optionalString (!stdenv.hostPlatform.isDarwin) "./test_c"}
|
||||
|
||||
cat <<EOF >test.cpp
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
int main() {
|
||||
std::cout << "Testing OpenWatcom C++ library implementation." << std::endl;
|
||||
watcom::istring HELLO ("HELLO");
|
||||
if (HELLO != "hello") {
|
||||
return 1;
|
||||
}
|
||||
if (HELLO.find ("ello") != 1) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
cat test.cpp
|
||||
# Darwin target not supported, only host
|
||||
wcl386 -fe=test_cpp test.cpp
|
||||
${lib.optionalString (!stdenv.hostPlatform.isDarwin) "./test_cpp"}
|
||||
touch $out
|
||||
'';
|
||||
cross = runCommand "${name}-test-cross" { nativeBuildInputs = [ wrapped file ]; } ''
|
||||
cat <<EOF >test.c
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf ("Testing OpenWatcom cross-compilation.\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
cat test.c
|
||||
|
||||
echo "Test compiling"
|
||||
wcl386 -bcl=linux -fe=linux test.c
|
||||
wcl386 -bcl=nt -fe=nt test.c
|
||||
wcl386 -bcl=dos4g -fe=dos4g test.c
|
||||
wcl -bcl=windows -fe=windows test.c
|
||||
wcl -bcl=dos -fe=dos test.c
|
||||
|
||||
echo "Test file format"
|
||||
file ./linux | grep "32-bit" | grep "Linux"
|
||||
file ./nt.exe | grep "PE32" | grep "Windows"
|
||||
file ./dos4g.exe | grep "MS-DOS" | grep "LE executable"
|
||||
file ./windows.exe | grep "MS-DOS" | grep "Windows 3.x"
|
||||
file ./dos.exe | grep "MS-DOS" | grep -v "LE" | grep -v "Windows 3.x"
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
inherit (open-watcom) meta;
|
||||
};
|
||||
in
|
||||
lib.makeOverridable wrapper
|
||||
Loading…
Add table
Add a link
Reference in a new issue