mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 09:43:45 +08:00
fix version generation
This commit is contained in:
parent
6418b00ac3
commit
9830e29945
14
Makefile
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)
|
||||
|
|
|
@ -148,6 +148,8 @@ void
|
|||
_getxattr_controlfile_version(string &attrvalue)
|
||||
{
|
||||
attrvalue = MERGERFS_VERSION;
|
||||
if(attrvalue.empty())
|
||||
attrvalue = "unknown_possible_problem_with_build";
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
@ -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
Executable file
16
tools/update-version
Executable file
|
@ -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…
Reference in New Issue
Block a user