Zulip Chat Archive

Stream: Is there code for X?

Topic: conditional compilation


Joachim Breitner (Dec 28 2023 at 15:35):

I have a lean executable (the loogle CLI) that I want to be able to compile with or (by default) without seccomp support. Seccomp support entails

  • In the lakefile.lean a target, an extern_lib and a lean_lib
  • In the main Loogle.lean one import and one line of code invoking it.
    By default, a user running lake build should see neither of these, but lake build -KSeccomp or something like this should work as it should.

I guess inside the lakefile.lean I can work with meta if, but how do I go about making the import and the Seccomp.enable line in Loogle.lean conditional?

Joachim Breitner (Jan 03 2024 at 17:48):

I gave it a shot on my own, and hacked something up by querying the environment variables in the lakefile and the actual code. Seems to work… :shrug: (https://github.com/nomeata/loogle/commit/b1751fc63f009f809ee7d7ab4b475b7284ffd395)


Last updated: May 02 2025 at 03:31 UTC