Merge pull request #1641 from Deiz/fix-1640
Store Git commit identifier in its own object
This commit is contained in:
commit
5e7339d8f0
|
@ -33,3 +33,4 @@ docs/*.html
|
||||||
i3-command-parser.stamp
|
i3-command-parser.stamp
|
||||||
i3-config-parser.stamp
|
i3-config-parser.stamp
|
||||||
.clang_complete
|
.clang_complete
|
||||||
|
LAST_VERSION
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -22,6 +22,12 @@ include i3-dump-log/i3-dump-log.mk
|
||||||
include docs/docs.mk
|
include docs/docs.mk
|
||||||
include man/man.mk
|
include man/man.mk
|
||||||
|
|
||||||
|
# Update $(TOPDIR)/LAST_VERSION if it differs from $I3_VERSION
|
||||||
|
CACHED_VERSION := '$(shell [ -f $(TOPDIR)/LAST_VERSION ] && cat $(TOPDIR)/LAST_VERSION)'
|
||||||
|
ifneq ($(CACHED_VERSION),$(I3_VERSION))
|
||||||
|
$(shell echo -n ${I3_VERSION} > $(TOPDIR)/LAST_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
real-all: $(ALL_TARGETS)
|
real-all: $(ALL_TARGETS)
|
||||||
|
|
||||||
install: $(INSTALL_TARGETS)
|
install: $(INSTALL_TARGETS)
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
|
|
||||||
|
/** Git commit identifier, from version.c */
|
||||||
|
extern const char *i3_version;
|
||||||
|
|
||||||
/** The original value of RLIMIT_CORE when i3 was started. We need to restore
|
/** The original value of RLIMIT_CORE when i3 was started. We need to restore
|
||||||
* this before starting any other process, since we set RLIMIT_CORE to
|
* this before starting any other process, since we set RLIMIT_CORE to
|
||||||
* RLIM_INFINITY for i3 debugging versions. */
|
* RLIM_INFINITY for i3 debugging versions. */
|
||||||
|
|
|
@ -996,7 +996,7 @@ bool parse_file(const char *f, bool use_nagbar) {
|
||||||
check_for_duplicate_bindings(context);
|
check_for_duplicate_bindings(context);
|
||||||
|
|
||||||
if (use_nagbar && (context->has_errors || context->has_warnings)) {
|
if (use_nagbar && (context->has_errors || context->has_warnings)) {
|
||||||
ELOG("FYI: You are using i3 version " I3_VERSION "\n");
|
ELOG("FYI: You are using i3 version %s\n", i3_version);
|
||||||
if (version == 3)
|
if (version == 3)
|
||||||
ELOG("Please convert your configfile first, then fix any remaining errors (see above).\n");
|
ELOG("Please convert your configfile first, then fix any remaining errors (see above).\n");
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ include/all.h.pch: $(i3_HEADERS)
|
||||||
echo "[i3] PCH all.h"
|
echo "[i3] PCH all.h"
|
||||||
$(CC) $(I3_CPPFLAGS) $(XCB_CPPFLAGS) $(CPPFLAGS) $(i3_CFLAGS) $(I3_CFLAGS) $(CFLAGS) -x c-header include/all.h -o include/all.h.pch
|
$(CC) $(I3_CPPFLAGS) $(XCB_CPPFLAGS) $(CPPFLAGS) $(i3_CFLAGS) $(I3_CFLAGS) $(CFLAGS) -x c-header include/all.h -o include/all.h.pch
|
||||||
|
|
||||||
|
src/version.o: src/version.c LAST_VERSION $(i3_HEADERS_DEP)
|
||||||
|
echo "[i3] CC $<"
|
||||||
|
$(CC) $(I3_CPPFLAGS) $(XCB_CPPFLAGS) $(CPPFLAGS) $(i3_CFLAGS) $(I3_CFLAGS) $(CFLAGS) $(PCH_FLAGS) -c -o $@ ${canonical_path}/$<
|
||||||
|
|
||||||
src/%.o: src/%.c $(i3_HEADERS_DEP)
|
src/%.o: src/%.c $(i3_HEADERS_DEP)
|
||||||
echo "[i3] CC $<"
|
echo "[i3] CC $<"
|
||||||
$(CC) $(I3_CPPFLAGS) $(XCB_CPPFLAGS) $(CPPFLAGS) $(i3_CFLAGS) $(I3_CFLAGS) $(CFLAGS) $(PCH_FLAGS) -c -o $@ ${canonical_path}/$<
|
$(CC) $(I3_CPPFLAGS) $(XCB_CPPFLAGS) $(CPPFLAGS) $(i3_CFLAGS) $(I3_CFLAGS) $(CFLAGS) $(PCH_FLAGS) -c -o $@ ${canonical_path}/$<
|
||||||
|
@ -92,4 +96,4 @@ install-i3: i3
|
||||||
|
|
||||||
clean-i3:
|
clean-i3:
|
||||||
echo "[i3] Clean"
|
echo "[i3] Clean"
|
||||||
rm -f $(i3_OBJECTS) $(i3_SOURCES_GENERATED) $(i3_HEADERS_CMDPARSER) include/loglevels.h loglevels.tmp include/all.h.pch i3-command-parser.stamp i3-config-parser.stamp i3 test.config_parser test.commands_parser src/*.gcno src/cfgparse.* src/cmdparse.*
|
rm -f $(i3_OBJECTS) $(i3_SOURCES_GENERATED) $(i3_HEADERS_CMDPARSER) include/loglevels.h loglevels.tmp include/all.h.pch i3-command-parser.stamp i3-config-parser.stamp i3 test.config_parser test.commands_parser src/*.gcno src/cfgparse.* src/cmdparse.* LAST_VERSION
|
||||||
|
|
|
@ -791,7 +791,7 @@ IPC_HANDLER(get_version) {
|
||||||
y(integer, PATCH_VERSION);
|
y(integer, PATCH_VERSION);
|
||||||
|
|
||||||
ystr("human_readable");
|
ystr("human_readable");
|
||||||
ystr(I3_VERSION);
|
ystr(i3_version);
|
||||||
|
|
||||||
y(map_close);
|
y(map_close);
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void handle_signal(int sig, siginfo_t *info, void *data) {
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
/* Keep a symbol pointing to the I3_VERSION string constant so that we have
|
/* Keep a symbol pointing to the I3_VERSION string constant so that we have
|
||||||
* it in gdb backtraces. */
|
* it in gdb backtraces. */
|
||||||
const char *i3_version __attribute__((unused)) = I3_VERSION;
|
const char *_i3_version __attribute__((unused)) = i3_version;
|
||||||
char *override_configpath = NULL;
|
char *override_configpath = NULL;
|
||||||
bool autostart = true;
|
bool autostart = true;
|
||||||
char *layout_path = NULL;
|
char *layout_path = NULL;
|
||||||
|
@ -261,11 +261,11 @@ int main(int argc, char *argv[]) {
|
||||||
only_check_config = true;
|
only_check_config = true;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("i3 version " I3_VERSION " © 2009-2014 Michael Stapelberg and contributors\n");
|
printf("i3 version %s © 2009-2014 Michael Stapelberg and contributors\n", i3_version);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
printf("Binary i3 version: " I3_VERSION " © 2009-2014 Michael Stapelberg and contributors\n");
|
printf("Binary i3 version: %s © 2009-2014 Michael Stapelberg and contributors\n", i3_version);
|
||||||
display_running_version();
|
display_running_version();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
|
@ -456,7 +456,7 @@ int main(int argc, char *argv[]) {
|
||||||
free(cwd);
|
free(cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("i3 " I3_VERSION " starting\n");
|
LOG("i3 %s starting\n", i3_version);
|
||||||
|
|
||||||
conn = xcb_connect(NULL, &conn_screen);
|
conn = xcb_connect(NULL, &conn_screen);
|
||||||
if (xcb_connection_has_error(conn))
|
if (xcb_connection_has_error(conn))
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=4:sw=4:expandtab
|
||||||
|
*
|
||||||
|
* i3 - an improved dynamic tiling window manager
|
||||||
|
* © 2009-2015 Michael Stapelberg and contributors (see also: LICENSE)
|
||||||
|
*
|
||||||
|
* Stores the latest Git commit identifier so that it can be linked into i3
|
||||||
|
* and used dynamically without recompiling every object file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const char *i3_version = I3_VERSION;
|
Loading…
Reference in New Issue