Merge pull request #150 from autc04/cachix

Cachix & Universal
This commit is contained in:
Wolfgang Thaller 2022-01-17 22:55:36 +01:00 committed by GitHub
commit 229edc3957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 17 deletions

View File

@ -215,7 +215,13 @@ void MakeImportLibrary(char *pefptr, size_t pefsize, fs::path dest, fs::path tmp
bool MakeImportLibraryMulti(fs::path path, fs::path libname)
{
ResourceFile resFile;
assert(resFile.read(path.string()));
bool readSuccess = resFile.read(path.string());
if (!readSuccess)
{
std::cerr << "Could not read input file.\n";
return false;
}
std::vector<char> data(resFile.data.begin(), resFile.data.end());

View File

@ -1,10 +1,12 @@
trigger:
- master
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-20.04'
timeoutInMinutes: 90
steps:
- checkout: self
submodules: true
@ -37,6 +39,7 @@ jobs:
- job: macOS
pool:
vmImage: 'macOS-10.15'
timeoutInMinutes: 90
steps:
- checkout: self
submodules: true
@ -69,10 +72,9 @@ jobs:
- checkout: self
submodules: true
- script: |
docker run -i --name nix -v`pwd`:/src nixos/nix:latest <<EOF
chmod 1777 /tmp
nix-channel --add https://nixos.org/channels/nixos-21.11 nixpkgs
nix-channel --update
docker run -i --name nix -v`pwd`:/src nixos/nix:2.3.12 <<EOF
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use autc04
nix-build src -A m68k.retro68.samples
EOF
displayName: Build inside nixos/nix docker
@ -84,7 +86,18 @@ jobs:
- publish: CompiledSamples
artifact: 68K Samples
- script: |
docker start nix -i <<EOF
export CACHIX_AUTH_TOKEN=$CACHIX_AUTH_TOKEN
cd src
nix-build -A m68k.retro68.samples | cachix push autc04
nix-shell -A m68k --command exit
nix-store -qR --include-outputs \$(nix-instantiate default.nix -A m68k) | cachix push autc04
EOF
displayName: Push to Cachix
env:
CACHIX_AUTH_TOKEN: $(CACHIX_AUTH_TOKEN)
- job: nix_ppc
pool:
@ -93,10 +106,10 @@ jobs:
- checkout: self
submodules: true
- script: |
docker run -i --name nix -v`pwd`:/src nixos/nix:latest <<EOF
docker run -i --name nix -v`pwd`:/src nixos/nix:2.3.12 <<EOF
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use autc04
chmod 1777 /tmp
nix-channel --add https1://nixos.org/channels/nixos-21.11 nixpkgs
nix-channel --update
nix-build src -A powerpc.retro68.samples
EOF
displayName: Build inside nixos/nix docker
@ -107,3 +120,14 @@ jobs:
displayName: Copy result out of docker
- publish: CompiledSamples
artifact: PowerPC Samples
- script: |
docker start nix -i <<EOF
export CACHIX_AUTH_TOKEN=$CACHIX_AUTH_TOKEN
cd src
nix-build -A powerpc.retro68.samples | cachix push autc04
nix-shell -A powerpc --command exit
nix-store -qR --include-outputs \$(nix-instantiate default.nix -A powerpc) | cachix push autc04
EOF
displayName: Push to Cachix
env:
CACHIX_AUTH_TOKEN: $(CACHIX_AUTH_TOKEN)

View File

@ -259,6 +259,7 @@ function setup68KLibraries()
function setupPPCLibraries()
{
DEST=${1:-"$PREFIX/universal"}
mkdir -p "$DEST/libppc"
case `ResInfo -n "$INTERFACELIB" 2> /dev/null || echo 0` in
0)
@ -273,7 +274,7 @@ function setupPPCLibraries()
echo "Building PowerPC import libraries..."
for shlib in "${SHAREDLIBRARIES}/"*; do
libname=`basename "$shlib"`
implib=lib${libname}.a
implib=lib${libname%.bin}.a
printf " %30s => %-30s\n" ${libname} ${implib}
MakeImport "$shlib" "$DEST/libppc/$implib" || true
done
@ -288,7 +289,7 @@ function setupPPCLibraries()
cp "$obj" "$DEST/libppc/"
basename=`basename "${obj%.o}"`
# and wrap it in a .a archive for convenience
lib="$PREFIX"/universal/libppc/lib$basename.a
lib="$DEST"/libppc/lib$basename.a
rm -f "$lib"
powerpc-apple-macos-ar cqs "$lib" "$obj"
fi

View File

@ -11,6 +11,7 @@ pkgs: prevPkgs: {
installPhase = ''
mkdir $out
cp *.bin $out/
rm -f $out/*.code.bin $out/*.rsrc.bin
'';
}) ({
dialog = ../Samples/Dialog;
@ -24,7 +25,7 @@ pkgs: prevPkgs: {
} // lib.optionalAttrs (targetPlatform.cmakeSystemName == "Retro68") {
systemextension = ../Samples/SystemExtension;
launcher = ../Samples/Launcher;
});
}) // { launchapplserver = self.launchapplserver; };
in runCommand "retro68.samples" { } ''
mkdir -p $out/
@ -40,7 +41,8 @@ pkgs: prevPkgs: {
nativeBuildInputs = [ buildPackages.ninja buildPackages.cmake ];
installPhase = ''
mkdir $out
cp *.bin $out/
cp Server/*.bin $out/
rm $out/*.code.bin $out/*.rsrc.bin
'';
};
});

View File

@ -26,20 +26,31 @@ pkgs: prevPkgs:
ConvertDiskImage $src decoded.dsk
export HOME=.
hmount decoded.dsk
mkdir -p CIncludes RIncludes lib68
mkdir -p CIncludes RIncludes
hcopy -t 'MPW-GM:MPW-GM:Interfaces&Libraries:Interfaces:CIncludes:*.h' CIncludes/
hcopy -t 'MPW-GM:MPW-GM:Interfaces&Libraries:Interfaces:RIncludes:*.r' RIncludes/
mkdir -p $out/include $out/RIncludes
bash ${../prepare-headers.sh} CIncludes $out/include
bash ${../prepare-rincludes.sh} RIncludes $out/RIncludes
hcopy -r 'MPW-GM:MPW-GM:Interfaces&Libraries:Libraries:Libraries:*.o' lib68
. ${../interfaces-and-libraries.sh}
'' + (pkgs.lib.optionalString (pkgs.targetPlatform.cmakeSystemName == "Retro68") ''
mkdir -p lib68
hcopy -r 'MPW-GM:MPW-GM:Interfaces&Libraries:Libraries:Libraries:*.o' lib68
M68KLIBRARIES=lib68
setup68KLibraries $out/
mv $out/lib68k $out/lib
'';
'') + (pkgs.lib.optionalString (pkgs.targetPlatform.cmakeSystemName != "Retro68") ''
mkdir -p libppc peflibs
hcopy -r 'MPW-GM:MPW-GM:Interfaces&Libraries:Libraries:PPCLibraries:*.o' libppc
hcopy -m 'MPW-GM:MPW-GM:Interfaces&Libraries:Libraries:SharedLibraries:*' peflibs
PPCLIBRARIES=libppc
SHAREDLIBRARIES=peflibs
INTERFACELIB=peflibs/InterfaceLib.bin
setupPPCLibraries $out/
mv $out/libppc $out/lib
'');
};
});
} // prevPkgs.lib.optionalAttrs (prevPkgs.targetPlatform ? retro68) {