]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #1654 from Deiz/complete-run-chdir
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 12 Apr 2015 17:46:54 +0000 (10:46 -0700)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 12 Apr 2015 17:46:54 +0000 (10:46 -0700)
Allow complete-run.pl to be run from any directory

.gitignore
Makefile
include/i3.h
src/con.c
src/config_parser.c
src/i3.mk
src/ipc.c
src/main.c
src/version.c [new file with mode: 0644]
testcases/Makefile.PL

index 1d4c1678aa4ed2abc89b7e5d856be089a3741022..617421ac1e92f3edc338c7b7c75d868e6696a608 100644 (file)
@@ -33,3 +33,4 @@ docs/*.html
 i3-command-parser.stamp
 i3-config-parser.stamp
 .clang_complete
+LAST_VERSION
index 1fed4df1ac59185a4540413db3c5b9e436f15344..fd3021017650d11c1daa6cfed7ee327a853b7dc8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,12 @@ include i3-dump-log/i3-dump-log.mk
 include docs/docs.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)
 
 install: $(INSTALL_TARGETS)
index 5ca875417bb163c386e5da8d462ffcc6d1a2c486..70ebc0006110dfd7d301a3cecc1fbae373152679 100644 (file)
@@ -24,6 +24,9 @@
 #include "data.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
  * this before starting any other process, since we set RLIMIT_CORE to
  * RLIM_INFINITY for i3 debugging versions. */
index 41dd0196ba8931e9793a7ba7c103e99a2ec0cbf8..dab8d29d439a36e56c21587819e03de0dfaaba99 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -1355,11 +1355,7 @@ void con_set_layout(Con *con, layout_t layout) {
          * with an orientation). Since we switched to splith/splitv layouts,
          * using the "default" layout (which "only" should happen when using
          * legacy configs) is using the last split layout (either splith or
-         * splitv) in order to still do the same thing.
-         *
-         * Starting from v4.6 though, we will nag users about using "layout
-         * default", and in v4.9 we will remove it entirely (with an
-         * appropriate i3-migrate-config mechanism). */
+         * splitv) in order to still do the same thing. */
         con->layout = con->last_split_layout;
         /* In case last_split_layout was not initialized… */
         if (con->layout == L_DEFAULT)
index eef03cae238e0cf7455fd64ca1b18658e47d977f..f325481275b7f07d09e4dbf02ffbc3d8ade03a63 100644 (file)
@@ -996,7 +996,7 @@ bool parse_file(const char *f, bool use_nagbar) {
     check_for_duplicate_bindings(context);
 
     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)
             ELOG("Please convert your configfile first, then fix any remaining errors (see above).\n");
 
index 8c7634643ab7cc10292abda8869e24dfd435556d..cfa9fd16834d65fae62dc5238d707aaf0d7e983c 100644 (file)
--- a/src/i3.mk
+++ b/src/i3.mk
@@ -32,6 +32,10 @@ include/all.h.pch: $(i3_HEADERS)
        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
 
+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)
        echo "[i3] CC $<"
        $(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:
        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
index 8fed75f1b13dbf3993d7ac4c7dbbfa80bf4fbd58..f8138f0a995bb47685b61f024f2a8c9f6e80a7d2 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -791,7 +791,7 @@ IPC_HANDLER(get_version) {
     y(integer, PATCH_VERSION);
 
     ystr("human_readable");
-    ystr(I3_VERSION);
+    ystr(i3_version);
 
     y(map_close);
 
index 8b514178bbbf3283fc9391f11ef5c6f42643ba1a..ac40e7a389bc2eb41c303a2dd28637e4fea8007c 100644 (file)
@@ -188,7 +188,7 @@ static void handle_signal(int sig, siginfo_t *info, void *data) {
 int main(int argc, char *argv[]) {
     /* Keep a symbol pointing to the I3_VERSION string constant so that we have
      * it in gdb backtraces. */
-    const char *i3_version __attribute__((unused)) = I3_VERSION;
+    const char *_i3_version __attribute__((unused)) = i3_version;
     char *override_configpath = NULL;
     bool autostart = true;
     char *layout_path = NULL;
@@ -261,11 +261,11 @@ int main(int argc, char *argv[]) {
                 only_check_config = true;
                 break;
             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);
                 break;
             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();
                 exit(EXIT_SUCCESS);
                 break;
@@ -456,7 +456,7 @@ int main(int argc, char *argv[]) {
         free(cwd);
     }
 
-    LOG("i3 " I3_VERSION " starting\n");
+    LOG("i3 %s starting\n", i3_version);
 
     conn = xcb_connect(NULL, &conn_screen);
     if (xcb_connection_has_error(conn))
diff --git a/src/version.c b/src/version.c
new file mode 100644 (file)
index 0000000..d7d31b3
--- /dev/null
@@ -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;
index f2c15013f5246b7e9346819d60365818d4fd68dd..3c2a26f97255c09161e13c03f48ee4658aaa8b0e 100755 (executable)
@@ -8,8 +8,8 @@ WriteMakefile(
     MIN_PERL_VERSION => '5.010000', # 5.10.0
     PREREQ_PM => {
         'AnyEvent'     => 0,
-        'AnyEvent::I3' => '0.15',
-        'X11::XCB'     => '0.09',
+        'AnyEvent::I3' => '0.16',
+        'X11::XCB'     => '0.12',
         'Inline'       => 0,
         'Inline::C'    => 0,
         'ExtUtils::PkgConfig' => 0,