Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: allow to pass in VERSION / GIT_VERSION #160

Closed
blueyed opened this issue Mar 7, 2015 · 2 comments
Closed

build: allow to pass in VERSION / GIT_VERSION #160

blueyed opened this issue Mar 7, 2015 · 2 comments

Comments

@blueyed
Copy link
Member

blueyed commented Mar 7, 2015

I am looking into adding a awesome-git package to Nix / nixpkgs, and it uses --depth 1 when fetching the git source, which does not allow for "git describe" to work properly.

I've seen another build definition, which passes in makeFlags = "VERSION=v${version} GIT_VERSION=v${version}"; (https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/emacs-modes/haskell/git.nix), which might be helpful in this regard.

My current workaround is not using Git to fetch it (which is good anyway), and then write the version to .version-stamp manually.

While the current approach is good enough for me in this case, it might be nice to support passing in VERSION maybe for this?

@psychon
Copy link
Member

psychon commented Mar 8, 2015

This is the relevant part of awesomeConfig.cmake:

# {{{ Version stamp
if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
    # get current version
    execute_process(
        COMMAND ${GIT_EXECUTABLE} describe --dirty
        WORKING_DIRECTORY ${SOURCE_DIR}
        OUTPUT_VARIABLE VERSION
        OUTPUT_STRIP_TRAILING_WHITESPACE)
    # file the git-version-stamp.sh script will look into
    set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp)
    file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
    # create a version_stamp target later
    set(BUILD_FROM_GIT TRUE)
elseif( EXISTS ${SOURCE_DIR}/.version_stamp )
    # get version from version stamp
    file(READ ${SOURCE_DIR}/.version_stamp VERSION)
endif()
# }}}

The variable VERSION is already set to devel at the beginning of the file. So... Dunno. Introduce an OVERRIDE_VERSION variable which is only evaluated after this?

if(OVERRIDE_VERSION)
    set(VERSION ${OVERRIDE_VERSION})
endif()

I'm not fully convinced.

Edit: This would later be overwriten by the version_stamp target running build-utils/git-version-stamp.sh... Why do we have two places running "git describe" anyway` :-(

@blueyed
Copy link
Member Author

blueyed commented Mar 9, 2015

Why do we have two places running "git describe" anyway`

Yes, that should get fixed probably anyway.

blueyed added a commit that referenced this issue Jul 23, 2015
blueyed added a commit that referenced this issue Jul 24, 2015
petoju pushed a commit to petoju/awesome that referenced this issue Sep 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants