flatpak / flatpak-builder

Tool to build flatpaks from source
GNU Lesser General Public License v2.1
142 stars 93 forks source link

[Feature request]: Create a symlink to currently building module dir (`FLATPAK_BUILDER_BUILDDIR`) #488

Open tinywrkb opened 2 years ago

tinywrkb commented 2 years ago

Checklist

Suggestion

The current building module dir, /run/build/ModuleName is unique and different for each module.
While FLATPAK_BUILDER_BUILDDIR environment variable is available in the building instance, it can't be used in the env property.
I suggest adding the symlink /run/build/.current that will point to /run/build/ModuleName.

This will help avoid having to set per-module environment variables, like these used for building Node.js modules, Golang, etc. Instead, it would be possible to set these variables globally or using a YAML alias, making the Flatpak manifest shorter, more concise, and require less maintenance.

tinywrkb commented 2 years ago

p.s. my current solution is to use eval.

x-golang-offline-build-options: &golang-offline-build-options
  env:
    GO111MODULE: off
    GOVARS: GOBIN=${FLATPAK_DEST}/bin GOPATH=${FLATPAK_BUILDER_BUILDDIR}
x-golang-online-build-options: &golang-online-build-options
  build-args:
    - --share=network
  env:
    GO111MODULE: off
    GOVARS: GOBIN=${FLATPAK_DEST}/bin GOPATH=${FLATPAK_BUILDER_BUILDDIR}
...
  - name: modname
    build-options: *golang-offline-build-options
   #build-options: *golang-online-build-options
    buildsystem: simple
    build-commands:
     #- eval ${GOVARS} go get; exit 1 # ONLINE-BUILD
      - eval ${GOVARS} go install # OFFLINE-BUILD
    sources:
      - type: archive
...
      - modname-go-sources.json # OFFLINE-BUILD, flatpak-go-get-generator.py -o modname-go-sources.json ./
...