Skip to content

Question: Should the program version be more specific? #206

Description

@usfbih8u

I’m thinking something like:

  • st-0.9.3-04ce0d6-flexipatch-aa56259
    • Ideally, the upstream hash should also be included in the VERSION (config.mk).
  • st-0.9.3-flexipatch-aa56259
  • st-flexipatch-aa56259

We could add patches as well:

$ st -v
st-0.9.3-04ce0d6-flexipatch-aa56259

With patches:

  * ALPHA_PATCH
  * ANYSIZE_SIMPLE_PATCH
  * CLIPBOARD_PATCH
  * DELKEY_PATCH
  * NETWMICON_LEGACY_PATCH
  * OPENURLONCLICK_PATCH
  * OSC133_PATCH
  * SCROLLBACK_PATCH
  * SCROLLBACK_MOUSE_ALTSCREEN_PATCH
  * SIXEL_PATCH
  * WIDE_GLYPHS_PATCH
  * XRESOURCES_PATCH
  * XRESOURCES_RELOAD_PATCH

a script to generate the program version that’s passed to the binary:

#!/bin/bash

readonly st_base_version="${1}"

# shellcheck disable=SC2028 # I want echo to NOT escape sequences in this function.
{
    git_version=$(git describe --always --dirty)

    patches_enabled=$(
        grep "#define .* 1" patches.h | cut --delimiter ' ' --fields 2
    )

    echo -n "\\\""
    # FIXME ideally we should add '04ce0d6' to the `VERSION` in `config.mk`
    # so its part of `st_base_version`
    echo -n "st-${st_base_version}-flexipatch-${git_version}"
    echo -n "\n\nWith patches:\n\n"
    for patch in ${patches_enabled}; do echo -n "  * ${patch}\n"; done
    echo -n "\\\""
}

Example in the Makefile:

VERSION = 0.9.3-04ce0d6

example: c.c git-version
	gcc -DVERSION="$(shell ./git-version $(VERSION))" c.c -o example
// c.c
#include <stdio.h>
#ifndef VERSION
    #error "NO VERSION PROVIDED!"
#endif
int main(void)
{
	printf("%s\n", VERSION);
	return 0;
}

Thoughts? Would you like me to open a PR for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions