Revert "Generate FISH_BUILD_VERSION info for cmake builds"

This reverts commit 25839b8c36.

This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
This commit is contained in:
ridiculousfish 2018-01-07 22:25:29 -08:00
parent d67b4d6ca7
commit da8db7f6f0
5 changed files with 16 additions and 48 deletions

View file

@ -55,18 +55,16 @@ SET(FISH_SRCS
# Header files are just globbed.
FILE(GLOB FISH_HEADERS src/*.h)
# git_version_gen.sh creates FISH-BUILD-VERSION-FILE if it does not exist, and updates it
# only if it is out-of-date.
execute_process(
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/build_tools/cmake_git_version_gen.sh"
OUTPUT_VARIABLE FISH_BUILD_VERSION)
# Set up the version target.
# This creates the file FISH-BUILD-VERSION-FILE which is only modified if necessary.
ADD_CUSTOM_COMMAND(OUTPUT "FISH-BUILD-VERSION-FILE"
DEPENDS CHECK-FISH-BUILD-VERSION-FILE)
message(STATUS "FISH_BUILD_VERSION: ${FISH_BUILD_VERSION}")
ADD_CUSTOM_TARGET("CHECK-FISH-BUILD-VERSION-FILE"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh)
SET(FBVF "FISH-BUILD-VERSION-FILE")
# Set up fish-build-version.h
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/fish_build_version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/fish_build_version.h")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
# Set up config.h
INCLUDE(cmake/ConfigureChecks.cmake)
@ -77,8 +75,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# Set up standard directories.
INCLUDE(GNUInstallDirs)
ADD_DEFINITIONS(-DCMAKE
-D_UNICODE=1
ADD_DEFINITIONS(-D_UNICODE=1
-DFISH_BUILD_VERSION="${FISH_BUILD_VERSION}"
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
-DPREFIX=L"${CMAKE_INSTALL_PREFIX}"
-DDATADIR=L"${CMAKE_INSTALL_FULL_DATADIR}"

View file

@ -1,24 +0,0 @@
#!/bin/sh
# Originally from the git sources (GIT-VERSION-GEN)
# Presumably (C) Junio C Hamano <junkio@cox.net>
# Reused under GPL v2.0
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
# Obtain directory containing this script in POSIX-compatible manner
# See https://stackoverflow.com/a/43919044/17027 (public domain)
a="/$0"; a="${a%/*}"; a="${a:-.}"; a="${a#/}/"; BASEDIR=$(cd "$a"; pwd)
# Find the fish git directory as two levels up from this directory.
GIT_DIR=$(dirname "$a")
DEF_VER=unknown
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f version
then
VN=$(cat version) || VN="$DEF_VER"
elif ! VN=$(git -C "$GIT_DIR" describe --always --dirty 2>/dev/null); then
VN="$DEF_VER"
fi
echo -n "$VN"

View file

@ -109,10 +109,11 @@ FISH_CREATE_DIRS(${rel_datadir}/pkgconfig ${extra_completionsdir}
# @echo "Installing pkgconfig file"
# $v $(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig
# main CMakeFiles.txt sets ${FISH_BUILD_VERSION}, not ${fish_build_version}
set(fish_build_version ${FISH_BUILD_VERSION})
CONFIGURE_FILE(fish.pc.in fish.pc)
CONFIGURE_FILE(fish.pc.in fish.pc.noversion)
ADD_CUSTOM_COMMAND(OUTPUT fish.pc
COMMAND awk -v `cat ${FBVF}` '/^Version:/ {$$0=$$0 FISH_BUILD_VERSION} 1' fish.pc.noversion > fish.pc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${FBVF} ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
DESTINATION ${rel_datadir}/pkgconfig)
@ -178,7 +179,7 @@ INSTALL(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
INSTALL(FILES share/lynx.lss DESTINATION ${rel_datadir}/fish/)
# Group install targets into a InstallTargets folder
SET_PROPERTY(TARGET
SET_PROPERTY(TARGET CHECK-FISH-BUILD-VERSION-FILE
test_invocation test_fishscript
test_prep tests_buildroot_target
build_lexicon_filter

View file

@ -1,4 +0,0 @@
#pragma once
//to be filled in by cmake
#define FISH_BUILD_VERSION "@FISH_BUILD_VERSION@"

View file

@ -1,5 +1,2 @@
// Prototype for version receiver.
#ifdef CMAKE
#include <fish_build_version.h>
#endif
const char *get_fish_version();