PkgForge
GithubSoar
  • Orgs
    • PkgForge (Core)
      • About
      • Projects
        • Soarpkgs
        • bincache
        • pkgcache
      • People
    • PkgForge-Community
    • PkgForge-Dev
      • Projects
        • Anylinux-AppImages
      • People
    • PkgForge-Security
      • Projects
        • CertStream
  • Soar
    • Soar (Docs)
    • Comparisons
      • 1. Candidates
      • 2. Dependencies
      • 3. Packages
      • 4. Security
  • Formats
    • Binaries
      • Dynamic
      • Static
        • Build Notes
          • Cargo (Rust)
          • GoLang
          • Make
          • Nim
          • Nix
          • Vlang
          • Zig (Musl)
        • Build Tests
    • Packages
      • Archive
      • AppBundle
      • AppImage
      • FlatImage
      • GameImage (TBD)
      • NixAppImage
      • RunImage
      • Errors & Quirks
        • Fonts
        • Fuse
        • Namespaces
        • Zsync
  • SBUILD
    • Introduction
    • Specification
      • 0.Prerequisite
      • 1.Shebang
      • 2.Pkg
      • 3.Version
      • 4.AppID
      • 5.BuildAsset
      • 6.BuildUtil
      • 7.Category
      • 8.Description
      • 9.Desktop
      • 10.DistroPkg
      • 11.HomePage
      • 12.Icon
      • 13.License
      • 14.Maintainer
      • 15.Note
      • 16.Provides
      • 17.Repology
      • 18.SourceURL
      • 19.Tag
      • 20.x_exec
    • Instructions
      • ENV_VARS (x_exec.run)
      • ENV_VARS (SBUILDER)
      • NEEDED_FILES
      • Examples
  • Repositories
    • soarpkgs
      • Contribution
      • Copy of DMCA | Copyright (Cease & Desist)
      • Differences
      • FAQ
      • Infra
      • Metadata
      • Package-Request
      • Security
    • bincache
      • Cache
      • Contribution
      • Differences
      • DMCA | Copyright (Cease & Desist)
      • FAQ
      • Infra
      • Metadata
      • Package-Request
      • Security
    • pkgcache
      • Cache
      • Contribution
      • Differences
      • DMCA | Copyright (Cease & Desist)
      • FAQ
      • Infra
      • Metadata
      • Package-Request
      • Security
    • external
      • AM
      • cargo-bins
      • appimage.github.io
      • AppImageHub
    • Nests
  • Contact
    • Chat
Powered by GitBook
On this page

Was this helpful?

  1. Formats
  2. Binaries
  3. Static
  4. Build Notes

Vlang

https://github.com/vlang/v/blob/master/README.md#docker-with-alpinemusl

!#Sane CFLAGS
export CFLAGS="-O2 -flto=auto -static -w -pipe"
export CXXFLAGS="${CFLAGS}"

!#Sane LDFLAGS
export LDFLAGS="-static -s -Wl,-S -Wl,--build-id=none"

!#VFLAGS (v help build || v help build-c)
# -cc --> Compiler
# -gc --> Garbage-Collector
# -v  --> Enable verbosity in the V compiler while compiling
# -w  --> Hide Warning
# -prod --> Compile the executable in production mode, where most optimizations are enabled
# -compress --> Compress the compiled executable with UPX
# -showcc --> Prints the C command that is used to build the program.
# -o <output>, -output <output> --> Force V to output the executable in a specific location
# -skip-unused --> Skip generating C/JS code for unused functions
# -freestanding --> Build the executable without dependency on libc
# -os <os>, -target-os <os> -->
# android | dragonfly | freebsd | haiku | ios | linux | macos | netbsd | openbsd | plan9 | serenity | solaris | termux | vinix | wasm32 | wasm32-wasi | wasm32-emscripten | windows
export VFLAGS="-cc clang -gc none -w -prod -compress -showcc -cflags \"-O2\" -cflags \"-flto=auto\" -cflags \"-static\" -cflags \"-w\" -cflags \"-pipe\" -ldflags \"-static\" -ldflags \"-s\" -ldflags \"-Wl,--build-id=none\""

!# Build Script (build.vsh)
eval v "${VFLAGS}" run "./build.vsh"

!# Single SRC file
v -cc "clang" -gc "none" -w -prod -compress -showcc -cflags "-O2" -cflags "-flto=auto" -cflags "-static" -cflags "-w" -cflags "-pipe" -ldflags "-static" -ldflags "-s" -ldflags "-Wl,-S" -ldflags "-Wl,--build-id=none" "./path/to/v_src/dir" -o "./path/to/output"
#Or
eval v "${VFLAGS}" "./path/to/v_src/dir" -o "./path/to/output"
PreviousNixNextZig (Musl)

Last updated 5 months ago

Was this helpful?