mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Generate version numbers dynamically
This commit hooks the Makefile up to generate a FISH_BUILD_VERSION symbol and kills off PACKAGE_VERSION in .cpp files. It also modifies the tarball generation script to add the necessary version file for releases.
This commit is contained in:
parent
05563ab11e
commit
2a06c72113
8 changed files with 26 additions and 9 deletions
16
Makefile.in
16
Makefile.in
|
@ -282,6 +282,17 @@ all: $(PROGRAMS) $(user_doc) share/man $(TRANSLATIONS)
|
|||
@echo Use \'$(MAKE) install\' to install fish.
|
||||
.PHONY: all
|
||||
|
||||
#
|
||||
# Pull version information
|
||||
#
|
||||
|
||||
FISH-BUILD-VERSION-FILE: FORCE
|
||||
@./build_tools/git_version_gen.sh
|
||||
-include FISH-BUILD-VERSION-FILE
|
||||
CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
|
||||
.PHONY: FORCE
|
||||
env.o fish.o fish_indent.o fish_pager.o fishd.o mimedb.o: FISH-BUILD-VERSION-FILE
|
||||
|
||||
|
||||
#
|
||||
# These dependencies make sure that autoconf and configure are run
|
||||
|
@ -313,7 +324,7 @@ prof: all
|
|||
# intermediate *.hdr and doc.h files if needed
|
||||
|
||||
user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $(HDR_FILES)
|
||||
(cat Doxyfile.user ; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - && touch user_doc
|
||||
(cat Doxyfile.user ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - && touch user_doc
|
||||
|
||||
|
||||
#
|
||||
|
@ -321,7 +332,7 @@ user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $(
|
|||
#
|
||||
|
||||
doc: *.h *.cpp doc.h Doxyfile
|
||||
(cat Doxyfile ; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - ;
|
||||
(cat Doxyfile ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ;
|
||||
|
||||
|
||||
#
|
||||
|
@ -849,6 +860,7 @@ clean:
|
|||
rm -f $(PROGRAMS) fish_tests key_reader
|
||||
rm -f command_list.txt toc.txt
|
||||
rm -f doc_src/index.hdr doc_src/commands.hdr
|
||||
rm -f FISH-BUILD-VERSION-FILE
|
||||
rm -f fish-@PACKAGE_VERSION@.tar
|
||||
rm -f fish-@PACKAGE_VERSION@.tar.gz
|
||||
rm -f fish-@PACKAGE_VERSION@.tar.bz2
|
||||
|
|
|
@ -19,8 +19,11 @@ wd="$PWD"
|
|||
# The name of the prefix, which is the directory that you get when you untar
|
||||
prefix="fish"
|
||||
|
||||
# Get the version from git-describe
|
||||
VERSION=`git describe --tags --dirty 2>/dev/null`
|
||||
|
||||
# The path where we will output the tar file
|
||||
path=~/fish_built/fish-2.0.tar
|
||||
path=~/fish_built/fish-$VERSION.tar
|
||||
|
||||
# Clean up stuff we've written before
|
||||
rm -f "$path" "$path".gz
|
||||
|
@ -31,11 +34,13 @@ git archive --format=tar --prefix="$prefix"/ master > "$path"
|
|||
# tarball out the documentation
|
||||
make user_doc
|
||||
make share/man
|
||||
echo $VERSION > version
|
||||
cd /tmp
|
||||
rm -f "$prefix"
|
||||
ln -s "$wd" "$prefix"
|
||||
gnutar --append --file="$path" "$prefix"/user_doc/html
|
||||
gnutar --append --file="$path" "$prefix"/share/man
|
||||
gnutar --append --file="$path" "$prefix"/version
|
||||
rm -f "$prefix"
|
||||
|
||||
# gzip it
|
||||
|
|
2
env.cpp
2
env.cpp
|
@ -667,7 +667,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */)
|
|||
/*
|
||||
Set up the version variables
|
||||
*/
|
||||
wcstring version = str2wcstring(PACKAGE_VERSION);
|
||||
wcstring version = str2wcstring(FISH_BUILD_VERSION);
|
||||
env_set(L"version", version.c_str(), ENV_GLOBAL);
|
||||
env_set(L"FISH_VERSION", version.c_str(), ENV_GLOBAL);
|
||||
|
||||
|
|
2
fish.cpp
2
fish.cpp
|
@ -350,7 +350,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *out_c
|
|||
fwprintf(stderr,
|
||||
_(L"%s, version %s\n"),
|
||||
PACKAGE_NAME,
|
||||
PACKAGE_VERSION);
|
||||
FISH_BUILD_VERSION);
|
||||
exit_without_destructors(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ int main(int argc, char **argv)
|
|||
fwprintf(stderr,
|
||||
_(L"%ls, version %s\n"),
|
||||
program_name,
|
||||
PACKAGE_VERSION);
|
||||
FISH_BUILD_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1289,7 +1289,7 @@ int main(int argc, char **argv)
|
|||
|
||||
case 'v':
|
||||
{
|
||||
debug(0, L"%ls, version %s\n", program_name, PACKAGE_VERSION);
|
||||
debug(0, L"%ls, version %s\n", program_name, FISH_BUILD_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -922,7 +922,7 @@ int main(int argc, char ** argv)
|
|||
exit(0);
|
||||
|
||||
case 'v':
|
||||
debug(0, L"%ls, version %s\n", program_name, PACKAGE_VERSION);
|
||||
debug(0, L"%ls, version %s\n", program_name, FISH_BUILD_VERSION);
|
||||
exit(0);
|
||||
|
||||
case '?':
|
||||
|
|
|
@ -1332,7 +1332,7 @@ int main(int argc, char *argv[])
|
|||
exit(0);
|
||||
|
||||
case 'v':
|
||||
printf(_("%s, version %s\n"), MIMEDB, PACKAGE_VERSION);
|
||||
printf(_("%s, version %s\n"), MIMEDB, FISH_BUILD_VERSION);
|
||||
exit(0);
|
||||
|
||||
case '?':
|
||||
|
|
Loading…
Reference in a new issue