Skip to content

Commit

Permalink
objfw: add passthru test (NixOS#366484)
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman authored Dec 23, 2024
2 parents dfc625c + 8b08f6a commit 4511148
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions pkgs/by-name/ob/objfw/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
clangStdenv,
fetchfossil,
lib,
objfw,
writeTextDir,
}:

clangStdenv.mkDerivation (finalAttrs: {
Expand All @@ -30,6 +32,47 @@ clangStdenv.mkDerivation (finalAttrs: {

doCheck = true;

passthru.tests = {
build-hello-world = clangStdenv.mkDerivation {
name = "ObjFW test";
buildInputs = [ objfw ];

src = writeTextDir "helloworld.m" ''
#import <ObjFW/ObjFW.h>
int main() {
OFLog(@"Hello world from objc");
return 0;
}
'';

buildPhase = ''
runHook preBuild
clang -o testbinary \
-x objective-c -Xclang \
-fobjc-runtime=objfw \
-funwind-tables \
-fconstant-string-class=OFConstantString \
-Xclang -fno-constant-cfstrings \
helloworld.m \
-lobjfw -lobjfwrt
runHook postBuild
'';

checkPhase = ''
runHook preCheck
./testbinary
runHook postCheck
'';
doCheck = true;

installPhase = ''
runHook preInstall
touch $out
runHook postInstall
'';
};
};

meta = {
description = "A portable framework for the Objective-C language";
homepage = "https://objfw.nil.im";
Expand Down

0 comments on commit 4511148

Please sign in to comment.