Import (really, this time) i3 3.c, from MAINTAINER Baptiste Daroussin,

with tweaks by me.

i3 is an improved dynamic, tiling window manager.

note: It is still young, so some debug options are still enable by
default, and it's a bit verbose.

ok ajacoutot@
This commit is contained in:
landry 2009-09-02 19:26:17 +00:00
parent b25effc5f7
commit 620da9e954
11 changed files with 287 additions and 0 deletions

33
x11/i3/Makefile Normal file
View File

@ -0,0 +1,33 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-3.c
PKGNAME = i3-3.3
CATEGORIES = x11
EXTRACT_SUFX = .tar.bz2
HOMEPAGE = http://i3.zekjur.net/
MASTER_SITES = ${HOMEPAGE}downloads/
MAINTAINER = Bapt <baptiste.daroussin@gmail.com>
# BSD
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
WANTLIB = X11 c m xcb xcb-atom xcb-aux xcb-event \
xcb-icccm xcb-keysyms xcb-property xcb-xinerama
MODULES = converters/libiconv
LIB_DEPENDS = ev::devel/libev
RUN_DEPENDS = ::x11/dmenu
USE_GMAKE = Yes
USE_X11 = Yes
pre-configure:
${SUBST_CMD} ${WRKSRC}/i3.config ${WRKSRC}/src/config.c
.include <bsd.port.mk>

5
x11/i3/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (i3-3.c.tar.bz2) = jjpMN4S+7lxQNMdXC8/xyA==
RMD160 (i3-3.c.tar.bz2) = lNfn7XDI1dVymFkJ2+aEtDw7B98=
SHA1 (i3-3.c.tar.bz2) = QgH86kbiPnXqpwv/W9K9Cr6auhk=
SHA256 (i3-3.c.tar.bz2) = kXJqpPuVj/flfOTwdMCGtzjqzCMb40vGDZ0xaT5JMVU=
SIZE (i3-3.c.tar.bz2) = 110076

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- Makefile.orig Wed Aug 19 14:39:09 2009
+++ Makefile Wed Sep 2 21:23:16 2009
@@ -8,24 +8,20 @@ HEADERS=$(wildcard include/*.h)
# Depend on the specific file (.c for each .o) and on all headers
src/%.o: src/%.c ${HEADERS}
- echo "CC $<"
$(CC) $(CFLAGS) -c -o $@ $<
all: ${FILES}
- echo "LINK i3"
$(CC) -o i3 ${FILES} $(LDFLAGS)
- echo ""
- echo "SUBDIR i3-msg"
$(MAKE) TOPDIR=$(TOPDIR) -C i3-msg
install: all
- echo "INSTALL"
- $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
- $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3
- $(INSTALL) -d -m 0755 $(DESTDIR)/usr/share/xsessions
- $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
- test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config
- $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/
+ $(INSTALL) -d -m 0755 $(PREFIX)/bin
+ $(INSTALL) -d -m 0755 $(PREFIX)/share/examples/i3
+ $(INSTALL) -d -m 0755 $(PREFIX)/share/xsessions
+ $(INSTALL) -m 0755 i3 $(PREFIX)/bin/
+ $(INSTALL) -m 4444 man/i3.1 $(PREFIX)/man/man1/
+ test -e $(PREFIX)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(PREFIX)/share/examples/i3/config
+ $(INSTALL) -m 0644 i3.desktop $(PREFIX)/share/xsessions/
$(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install
dist: distclean

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-common_mk,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- common.mk.orig Wed Aug 19 14:39:09 2009
+++ common.mk Wed Sep 2 21:23:04 2009
@@ -9,7 +9,7 @@ CFLAGS += -pipe
CFLAGS += -Wall
CFLAGS += -Wunused
CFLAGS += -Iinclude
-CFLAGS += -I/usr/local/include
+CFLAGS += -I${LOCALBASE}/include
CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
# Check if pkg-config is installed, because without pkg-config, the following
@@ -38,7 +38,7 @@ LDFLAGS += -lxcb-icccm
LDFLAGS += -lxcb-xinerama
LDFLAGS += -lX11
LDFLAGS += -lev
-LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
+LDFLAGS += -L${LOCALBASE}/lib -L/usr/pkg/lib
ifeq ($(UNAME),NetBSD)
# We need -idirafter instead of -I to prefer the systems iconv over GNU libiconv
@@ -50,6 +50,13 @@ ifeq ($(UNAME),FreeBSD)
LDFLAGS += -liconv
endif
+ifeq ($(UNAME),OpenBSD)
+CFLAGS += -ftrampolines
+CFLAGS += -I${X11BASE}/include
+LDFLAGS += -liconv
+LDFLAGS += -L${X11BASE}/lib
+endif
+
ifeq ($(UNAME),Linux)
CFLAGS += -D_GNU_SOURCE
endif
@@ -61,9 +68,6 @@ CFLAGS += -g3
else
CFLAGS += -O2
endif
-
-# Dont print command lines which are run
-.SILENT:
# Always remake the following targets
.PHONY: install clean dist distclean

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-i3-msg_Makefile,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- i3-msg/Makefile.orig Wed Aug 19 14:39:09 2009
+++ i3-msg/Makefile Mon Aug 31 20:33:37 2009
@@ -9,17 +9,14 @@ HEADERS=$(wildcard *.h)
# Depend on the specific file (.c for each .o) and on all headers
%.o: %.c ${HEADERS}
- echo "CC $<"
$(CC) $(CFLAGS) -c -o $@ $<
all: ${FILES}
- echo "LINK i3-msg"
$(CC) -o i3-msg ${FILES} $(LDFLAGS)
install: all
- echo "INSTALL"
- $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
- $(INSTALL) -m 0755 i3-msg $(DESTDIR)/usr/bin/
+ $(INSTALL) -d -m 0755 $(PREFIX)/bin
+ $(INSTALL) -m 0755 i3-msg $(PREFIX)/bin/
clean:
rm -f *.o

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-i3_config,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- i3.config.orig Wed Aug 19 14:39:09 2009
+++ i3.config Wed Sep 2 21:23:04 2009
@@ -4,7 +4,7 @@
# Tell i3 about your preferred terminal. You can refer to this as $terminal
# later. It is recommended to set this option to allow i3 to open a terminal
# containing the introduction on first start.
-terminal /usr/bin/urxvt
+terminal ${X11BASE}/bin/xterm
# ISO 10646 = Unicode
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
@@ -83,14 +83,14 @@ bind Mod1+Shift+18 m9
bind Mod1+Shift+19 m10
# Mod1+Enter starts a new terminal
-bind Mod1+36 exec /usr/bin/urxvt
+bind Mod1+36 exec ${X11BASE}/bin/xterm
# Mod1+Shift+q kills the current client
bind Mod1+Shift+24 kill
# Mod1+v starts dmenu and launches the selected application
# for now, we dont have an own launcher
-bind Mod1+55 exec /usr/bin/dmenu_run
+bind Mod1+55 exec ${LOCALBASE}/bin/dmenu_run
# Mod1+Shift+e exits i3
bind Mod1+Shift+26 exit

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-include_util_h,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- include/util.h.orig Wed Aug 19 14:39:09 2009
+++ include/util.h Mon Aug 31 14:01:38 2009
@@ -161,4 +161,11 @@ void switch_layout_mode(xcb_connection_t *conn, Contai
Client *get_matching_client(xcb_connection_t *conn,
const char *window_classtitle, Client *specific);
+/*
+ * Add a copy of memmem for OpenBSD
+ */
+#if defined(__OpenBSD__)
+void * memmem(const void *l, size_t l_len, const void *s, size_t s_len);
+#endif
+
#endif

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-src_config_c,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- src/config.c.orig Wed Aug 19 14:39:09 2009
+++ src/config.c Mon Aug 31 20:30:32 2009
@@ -226,8 +226,8 @@ void load_configuration(xcb_connection_t *conn, const
/* We first check for ~/.i3/config, then for /etc/i3/config */
char *globbed = glob_path("~/.i3/config");
if ((handle = fopen(globbed, "r")) == NULL)
- if ((handle = fopen("/etc/i3/config", "r")) == NULL)
- die("Neither \"%s\" nor /etc/i3/config could be opened\n", globbed);
+ if ((handle = fopen("${SYSCONFDIR}/i3/config", "r")) == NULL)
+ die("Neither \"%s\" nor ${SYSCONFDIR}/i3/config could be opened\n", globbed);
free(globbed);
}
char key[512], value[512], buffer[1026];
@@ -312,7 +312,17 @@ void load_configuration(xcb_connection_t *conn, const
rest++;
if (*rest != ' ')
die("Invalid binding (keysym)\n");
- new->symbol = strndup(sym, (rest - sym));
+#if defined(__OpenBSD__)
+ size_t len = strlen(sym);
+ if( len > (rest - sym))
+ len = (rest - sym);
+ new->symbol = malloc(len + 1);
+ memcpy(new->symbol,sym,len+1);
+ new->symbol[len]='\0';
+#else
+ new->symbol = strndup(sym, (rest - sym));
+#endif
+
}
rest++;
LOG("keycode = %d, symbol = %s, modifiers = %d, command = *%s*\n", new->keycode, new->symbol, modifiers, rest);

View File

@ -0,0 +1,57 @@
$OpenBSD: patch-src_util_c,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- src/util.c.orig Wed Aug 19 14:39:09 2009
+++ src/util.c Mon Aug 31 14:01:38 2009
@@ -15,6 +15,9 @@
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
+#if defined(__OpenBSD__)
+#include <sys/cdefs.h>
+#endif
#include <stdarg.h>
#include <assert.h>
#include <iconv.h>
@@ -466,3 +469,43 @@ done:
FREE(to_title_ucs);
return matching;
}
+
+
+#if defined(__OpenBSD__)
+
+/*
+ * Taken from FreeBSD
+ * Find the first occurrence of the byte string s in byte string l.
+ */
+
+void *
+memmem(const void *l, size_t l_len, const void *s, size_t s_len)
+{
+ register char *cur, *last;
+ const char *cl = (const char *)l;
+ const char *cs = (const char *)s;
+
+ /* we need something to compare */
+ if (l_len == 0 || s_len == 0)
+ return NULL;
+
+ /* "s" must be smaller or equal to "l" */
+ if (l_len < s_len)
+ return NULL;
+
+ /* special case where s_len == 1 */
+ if (s_len == 1)
+ return memchr(l, (int)*cs, l_len);
+
+ /* the last position where its possible to find "s" in "l" */
+ last = (char *)cl + l_len - s_len;
+
+ for (cur = (char *)cl; cur <= last; cur++)
+ if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
+ return cur;
+
+ return NULL;
+}
+
+#endif
+

2
x11/i3/pkg/DESCR Normal file
View File

@ -0,0 +1,2 @@
i3 is an improved dynamic, tiling window manager.
Inspired by wmii that supported Xinerama.

10
x11/i3/pkg/PLIST Normal file
View File

@ -0,0 +1,10 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
@bin bin/i3
@bin bin/i3-msg
@man man/man1/i3.1
share/examples/i3/
@sample ${SYSCONFDIR}/i3/
share/examples/i3/config
@sample ${SYSCONFDIR}/i3/config
share/xsessions/
share/xsessions/i3.desktop