Browse Source

fix version generation

pull/473/head
Antonio SJ Musumeci 7 years ago
parent
commit
9830e29945
  1. 14
      Makefile
  2. 2
      src/getxattr.cpp
  3. 13
      src/option_parser.cpp
  4. 16
      tools/update-version

14
Makefile

@ -84,7 +84,7 @@ help:
@echo "usage: make"
@echo "make XATTR_AVAILABLE=0 - to build program without xattrs functionality (auto discovered otherwise)"
$(TARGET): src/version.hpp obj/obj-stamp libfuse/lib/.libs/libfuse.a $(OBJ)
$(TARGET): version obj/obj-stamp libfuse/lib/.libs/libfuse.a $(OBJ)
cd libfuse && make
$(CXX) $(CFLAGS) $(OBJ) -o $@ libfuse/lib/.libs/libfuse.a -ldl $(LDFLAGS)
@ -102,15 +102,7 @@ ifeq ($(GIT_REPO),1)
endif
version:
ifeq ($(GIT_REPO),1)
$(eval VERSION := $(shell $(GIT) describe --always --tags --dirty))
@echo "$(VERSION)" > VERSION
endif
src/version.hpp: version
$(eval VERSION := $(shell cat VERSION))
@echo "#pragma once" > src/version.hpp
@echo "static const char MERGERFS_VERSION[] = \"$(VERSION)\";" >> src/version.hpp
tools/update-version
obj/obj-stamp:
$(MKDIR) -p obj
@ -229,6 +221,6 @@ endif
libfuse/lib/.libs/libfuse.a: libfuse_Makefile
cd libfuse && $(MAKE)
.PHONY: all clean install help
.PHONY: all clean install help version
-include $(DEPS)

2
src/getxattr.cpp

@ -148,6 +148,8 @@ void
_getxattr_controlfile_version(string &attrvalue)
{
attrvalue = MERGERFS_VERSION;
if(attrvalue.empty())
attrvalue = "unknown_possible_problem_with_build";
}
static

13
src/option_parser.cpp

@ -305,15 +305,6 @@ usage(void)
<< std::endl;
}
static
void
version(void)
{
std::cout << "mergerfs version: "
<< MERGERFS_VERSION
<< std::endl;
}
static
int
option_processor(void *data,
@ -344,7 +335,9 @@ option_processor(void *data,
break;
case MERGERFS_OPT_VERSION:
version();
std::cout << "mergerfs version: "
<< (MERGERFS_VERSION[0] ? MERGERFS_VERSION : "unknown")
<< std::endl;
fuse_opt_add_arg(outargs,"--version");
break;

16
tools/update-version

@ -0,0 +1,16 @@
#!/bin/sh
GIT=$(which git)
if [ "${GIT}" = "" ]; then
exit 0
fi
VERSION=$(git describe --always --tags --dirty)
echo -n "${VERSION}" > VERSION
grep -q \"${VERSION}\" src/version.hpp
RV=$?
if [ $RV -ne 0 ]; then
echo "#pragma once" > src/version.hpp
echo "static const char MERGERFS_VERSION[] = \"${VERSION}\";" >> src/version.hpp
fi
Loading…
Cancel
Save