crashappsec / chalk

Chalk allows you to follow code from development, through builds and into production.
https://crashoverride.com/
GNU General Public License v3.0
322 stars 11 forks source link

build(nimble): no longer strip debug builds #289

Open ee7 opened 2 months ago

ee7 commented 2 months ago

The post-build hook attempted to strip only release builds, but it stripped all builds because Nimble doesn't support checking custom defines in a nimble file. Check against release instead, which is built-in.

Before this PR:

$ nimble build -d:debug
[...]
$ file ./chalk
./chalk: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

With this PR:

$ nimble build -d:debug
[...]
$ file ./chalk
chalk: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

Closes: https://github.com/crashappsec/chalk/issues/288

Testing

ee7 commented 2 months ago

Do not merge as is. I thought I verified that this worked, but on double checking it seems like this PR currently causes release builds to no longer be stripped.

And given this Nimble file:

version       = "0.1.0"
author        = "Anonymous"
description   = "A new awesome nimble package"
license       = "MIT"
srcDir        = "src"
bin           = @["mypackage"]

requires "nim >= 2.0.0"

after build:
  when defined(release):
    echo "foo"

When I run:

nimble build -d:release

or

nimble -d:release build

I don't see foo. I thought that worked nowadays - I'm probably doing something stupid. I'll get back to this.