chalk icon indicating copy to clipboard operation
chalk copied to clipboard

build(nimble): no longer strip debug builds

Open ee7 opened this issue 1 year ago • 1 comments

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

  • run nimble build -d:debug, and verify that the binary is not stripped
  • run nimble build, and verify that the binary is stripped

ee7 avatar May 06 '24 17:05 ee7

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.

ee7 avatar May 08 '24 12:05 ee7

already solved via env var as nimble doesnt seem to honor var definitions

miki725 avatar Oct 14 '24 14:10 miki725