From bd707dc17cb88a0071ba381a8885d8b18376b263 Mon Sep 17 00:00:00 2001 From: Slightly Seasoned <90609005+slightly-seasoned@users.noreply.github.com> Date: Sat, 14 May 2022 13:38:24 -0230 Subject: [PATCH 1/4] Changes to `makefile`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Altered the compiler to `cc` for convenience since most *NIX systems ship with it. * Added a `PREFIX` variable to easily change where you want to install `rose`. * Added an `uninstall` target to easily uninstall `rose`. * Added `.PHONY` flag telling `make` that the following targets are not file targets. That’s it, hope you have a bright future developing `rose`! --- makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/makefile b/makefile index 67c2049..9c3aed4 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -CC = clang +CC = cc CFLAGS = `pkg-config --cflags gtk4 webkit2gtk-5.0 x11` LIBS = `pkg-config --libs gtk4 webkit2gtk-5.0 x11` OPTIONS = -Dgtk_doc=false -Dintrospection=false \ @@ -16,14 +16,18 @@ OPTIONS = -Dgtk_doc=false -Dintrospection=false \ -Db_coverage=false \ -Ddebug=false +PREFIX=/usr/local all: - ${CC} -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) + $(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) strip ./rose install: all - su -c "cp -f ./rose /usr/local/bin/rose && \ - cp -f ./scripts/dmenu_rose.sh /usr/local/bin/dmenu_rose" + cp -f ./rose $(PREFIX)/bin/rose + cp -f ./scripts/dmenu_rose.sh $(PREFIX)/bin/dmenu_rose + +uninstall: + rm -f $(PREFIX)/bin/rose $(PREFIX)/bin/dmenu_rose clean: rm -f rose compile_flags.txt @@ -31,4 +35,5 @@ clean: flags: echo $(CFLAGS) | sed 's/ /\n/g' > compile_flags.txt -.SILENT: all clean install flags +.PHONY: all clean install uninstall flags +.SILENT: all clean install uninstall flags From 7e49c4d73d2065c1d44818987f0405318155a0f6 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 14 May 2022 19:41:34 +0200 Subject: [PATCH 2/4] Add editorconfig This ensures all text editors and IDEs share the same basic config when editing the source code of Rose. Addition of a clang-format file should also be considered. --- .editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4be7de2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +charset = utf-8 +trim_trailing_whitespace = true From d69bb7d05abf4ba9766a943a94ffd22767f7a66d Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 14 May 2022 20:06:17 +0200 Subject: [PATCH 3/4] Use environment variables for CC and PREFIX Pull request #3 can break the compilation process. In my case, cc points to gcc which cannot handle the `-G_DISABLE_DEPRECATED` and the `-GDK_PIXBUF_DISABLE_DEPRECATED` command-line options whereas clang works like a charm. This commit allows the user to use whichever compiler they want through environment variables such as: CC=clang make all It also allows the user to define their preferred prefix with environment variables: PREFIX=$HOME/.local/bin make install --- makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 9c3aed4..e13e331 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,5 @@ -CC = cc +# -*- indent-tabs-mode: t -*- +CC ?= cc CFLAGS = `pkg-config --cflags gtk4 webkit2gtk-5.0 x11` LIBS = `pkg-config --libs gtk4 webkit2gtk-5.0 x11` OPTIONS = -Dgtk_doc=false -Dintrospection=false \ @@ -16,7 +17,7 @@ OPTIONS = -Dgtk_doc=false -Dintrospection=false \ -Db_coverage=false \ -Ddebug=false -PREFIX=/usr/local +PREFIX ?= /usr/local all: $(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) From 40aeb6bc598f6560640f15a6bb947f3948587f71 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 14 May 2022 20:14:22 +0200 Subject: [PATCH 4/4] Use config.def.h instead of config.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since config.h is destined to be modified by the end-user, I think it is better to adopt what suckless usually does and move config.h to config.def.h. This file is sort of a template from which the end-user can build their own config.h that won’t be tracked by git. If config.h doesn’t exist at compile-time, the makefile will automatically copy it from the template. --- .gitignore | 1 + config.h => config.def.h | 0 makefile | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .gitignore rename config.h => config.def.h (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18e58a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/config.h diff --git a/config.h b/config.def.h similarity index 100% rename from config.h rename to config.def.h diff --git a/makefile b/makefile index 9c3aed4..404410a 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,4 @@ +# -*- indent-tabs-mode: t -*- CC = cc CFLAGS = `pkg-config --cflags gtk4 webkit2gtk-5.0 x11` LIBS = `pkg-config --libs gtk4 webkit2gtk-5.0 x11` @@ -18,10 +19,15 @@ OPTIONS = -Dgtk_doc=false -Dintrospection=false \ PREFIX=/usr/local -all: +all: config.h rose + +rose: $(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) strip ./rose +config.h: + [ -f "$@" ] || cp config.def.h $@ + install: all cp -f ./rose $(PREFIX)/bin/rose cp -f ./scripts/dmenu_rose.sh $(PREFIX)/bin/dmenu_rose @@ -32,8 +38,11 @@ uninstall: clean: rm -f rose compile_flags.txt +clean-all: clean + rm -f config.h + flags: echo $(CFLAGS) | sed 's/ /\n/g' > compile_flags.txt -.PHONY: all clean install uninstall flags -.SILENT: all clean install uninstall flags +.PHONY: all clean clean-all install uninstall flags config.h +.SILENT: all clean clean-all install uninstall flags config.h