diff --git a/pkgs/by-name/ob/objfw/package.nix b/pkgs/by-name/ob/objfw/package.nix index cd29a1ab9fb89..6dd746184f351 100644 --- a/pkgs/by-name/ob/objfw/package.nix +++ b/pkgs/by-name/ob/objfw/package.nix @@ -5,6 +5,8 @@ clangStdenv, fetchfossil, lib, + objfw, + writeTextDir, }: clangStdenv.mkDerivation (finalAttrs: { @@ -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 + 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";