diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b72ec4..36b515a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,9 @@ jobs: - name: Build pmm run: | mkdir -p out - ${{ matrix.cc }} -O2 -Wall -static -std=c11 -o out/pmm${{ matrix.ext }} \ + VER=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }} + VER=${VER#v} + ${{ matrix.cc }} -O2 -Wall -static -std=c11 -DPMM_VERSION=\"$VER\" -o out/pmm${{ matrix.ext }} \ src/main.c src/json.c src/ini.c src/pmm.c src/http.c src/repo.c src/install.c \ src/sha256.c src/sha1.c src/mirrors.c src/pdm.c diff --git a/src/pmm.h b/src/pmm.h index 996bd40..2659dd7 100644 --- a/src/pmm.h +++ b/src/pmm.h @@ -13,6 +13,10 @@ void pmm_add_to_path(void); * clears back to the user-home default. Persisted across runs. */ void pmm_set_install_drive(const char *letter); +/* Set the install location to an exact absolute path (e.g. "D:\apps\pmm" or + * "/opt/pmm"). Config/cache/bin/root all live under it. Empty clears back. */ +void pmm_set_install_path(const char *path); + /* File-association record written to the per-user registry on install. */ typedef struct { const char *progid; /* e.g. "Node.JSFile" */ @@ -41,7 +45,9 @@ void pmm_reg_uninstall_clear(const char *pkg); void pmm_set_self_path(const char *argv0); const char *pmm_self_path(void); -#define PMM_VERSION "0.1.0" +#ifndef PMM_VERSION +#define PMM_VERSION "0.1.0" /* overridden at build time with -DPMM_VERSION="..." */ +#endif typedef enum { OS_WINDOWS, OS_LINUX, OS_MACOS, OS_UNKNOWN } PmmOS;