From 8daa7b9d08d1fae45fbf6b574d5588d25835d1cf Mon Sep 17 00:00:00 2001 From: Dex Conner Date: Sun, 24 Apr 2022 09:16:52 +0300 Subject: [PATCH] app-office/sc-im: carry flag / dep logic to ebuild Signed-off-by: Dex Conner --- .../sc-im/files/sc-im-0.8.2-automagic.patch | 110 ++++++++++++------ .../sc-im/files/sc-im-0.8.2-clipboard.patch | 14 +-- app-office/sc-im/sc-im-0.8.2.ebuild | 48 +++++--- 3 files changed, 110 insertions(+), 62 deletions(-) diff --git a/app-office/sc-im/files/sc-im-0.8.2-automagic.patch b/app-office/sc-im/files/sc-im-0.8.2-automagic.patch index dbdc73ca18..6ff1aeced7 100644 --- a/app-office/sc-im/files/sc-im-0.8.2-automagic.patch +++ b/app-office/sc-im/files/sc-im-0.8.2-automagic.patch @@ -1,47 +1,65 @@ --- src/Makefile +++ src/Makefile -@@ -83,7 +83,7 @@ +@@ -82,11 +82,6 @@ + LDLIBS += -pthread endif - # Check for gnuplot existance +-# Check for gnuplot existance -ifneq (, $(shell which gnuplot)) -+ifeq ($(PLOTS),yes) - CFLAGS += -DGNUPLOT +- CFLAGS += -DGNUPLOT +-endif +- + # OpenBSD does not implement wordexp() + ifeq ($(shell uname -s),OpenBSD) + CFLAGS += -DNO_WORDEXP +@@ -97,77 +92,6 @@ + LDLIBS += -ldl endif -@@ -116,38 +116,31 @@ - endif - - # NOTE: libxlsreader (libxls) is required for xls file reading support +-ifneq (, $(shell which pkg-config)) +- # Any system with pkg-config +- +- # NOTE: ncursesw (required) +- ifeq ($(shell uname -s),Darwin) +- # macOS' ncurses is built with wide-char support +- LDFLAGS += -lncurses +- else ifneq ($(shell pkg-config --exists ncursesw || echo 'no'),no) +- CFLAGS += $(shell pkg-config --cflags ncursesw) +- LDLIBS += $(shell pkg-config --libs ncursesw) +- else ifneq ($(shell pkg-config --exists ncurses || echo 'no'),no) +- # hopefully this includes wide character support then +- CFLAGS += $(shell pkg-config --cflags ncurses) +- LDLIBS += $(shell pkg-config --libs ncurses) +- else +- LDLIBS += -lncursesw +- endif +- +- # NOTE: libxlsreader (libxls) is required for xls file reading support - ifneq ($(shell pkg-config --exists libxls || echo 'no'),no) -+ ifeq ($(XLS),yes) - CFLAGS += -DXLS $(shell pkg-config --cflags libxls) - LDLIBS += $(shell pkg-config --libs libxls) - endif - - # NOTE: libxml and libzip are required for xlsx file import support +- CFLAGS += -DXLS $(shell pkg-config --cflags libxls) +- LDLIBS += $(shell pkg-config --libs libxls) +- endif +- +- # NOTE: libxml and libzip are required for xlsx file import support - ifneq ($(shell pkg-config --exists libzip libxml-2.0 || echo 'no'),no) -+ ifeq ($(XML_ZIP),yes) - CFLAGS += -DODS -DXLSX $(shell pkg-config --cflags libxml-2.0 libzip) - LDLIBS += $(shell pkg-config --libs libxml-2.0 libzip) - endif - - # NOTE: libxlsxwriter is required for xlsx file export support +- CFLAGS += -DODS -DXLSX $(shell pkg-config --cflags libxml-2.0 libzip) +- LDLIBS += $(shell pkg-config --libs libxml-2.0 libzip) +- endif +- +- # NOTE: libxlsxwriter is required for xlsx file export support - ifneq ($(shell pkg-config --exists xlsxwriter || echo 'no'),no) -+ ifeq ($(XLSX),yes) - CFLAGS += -DXLSX_EXPORT $(shell pkg-config --cflags xlsxwriter) - LDLIBS += $(shell pkg-config --libs xlsxwriter) - endif - - # NOTE: lua support +- CFLAGS += -DXLSX_EXPORT $(shell pkg-config --cflags xlsxwriter) +- LDLIBS += $(shell pkg-config --libs xlsxwriter) +- endif +- +- # NOTE: lua support - ifneq ($(shell pkg-config --exists lua || echo 'no'),no) # Check for user's default lua -+ ifeq ($(LUA),yes) - CFLAGS += -DXLUA $(shell pkg-config --cflags lua) - ifneq ($(shell uname -s),Darwin) - LDLIBS += $(shell pkg-config --libs lua) -Wl,--export-dynamic - else - LDLIBS += $(shell pkg-config --libs lua) -rdynamic - endif +- CFLAGS += -DXLUA $(shell pkg-config --cflags lua) +- ifneq ($(shell uname -s),Darwin) +- LDLIBS += $(shell pkg-config --libs lua) -Wl,--export-dynamic +- else +- LDLIBS += $(shell pkg-config --libs lua) -rdynamic +- endif - else ifneq ($(shell pkg-config --exists luajit || echo 'no'),no) # If not found, check for luajit - CFLAGS += -DXLUA $(shell pkg-config --cflags luajit) - ifneq ($(shell uname -s),Darwin) @@ -49,6 +67,26 @@ - else - LDLIBS += $(shell pkg-config --libs luajit) -rdynamic - endif - endif - else ifeq ($(shell uname -s),Darwin) - # macOS without pkg-config +- endif +-else ifeq ($(shell uname -s),Darwin) +- # macOS without pkg-config +- +- # macOS' ncurses is built with wide-char support +- LDFLAGS += -lncurses +-else ifeq ($(shell uname -s),NetBSD) +- # NetBSD without pkg-config +- +- CFLAGS += -I/usr/pkg/include +- CFLAGS += -I/usr/pkg/include/ncursesw +- +- LDFLAGS += -L/usr/pkg/lib +- LDFLAGS += -Wl,-R/usr/pkg/lib +- +- LDLIBS += -lncursesw +-else +- LDFLAGS += -lncursesw +-endif +- + OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o + + .PHONY : all clean install docs man_install man_uninstall diff --git a/app-office/sc-im/files/sc-im-0.8.2-clipboard.patch b/app-office/sc-im/files/sc-im-0.8.2-clipboard.patch index 88815c8269..2668e7d294 100644 --- a/app-office/sc-im/files/sc-im-0.8.2-clipboard.patch +++ b/app-office/sc-im/files/sc-im-0.8.2-clipboard.patch @@ -1,20 +1,8 @@ --- src/Makefile +++ src/Makefile -@@ -57,8 +57,19 @@ - # +@@ -58,7 +58,7 @@ # Choose one of the following commands for copying to different clipboards: # You can later change it at runtime. -+ifeq ($(TMUX),yes) -+ CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" -+ CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\" -+else ifeq ($(WAYLAND),yes) -+ CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""wl-copy <"\" -+ CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""wl-paste"\" -+else ifeq ($(X),yes) -+ CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" -+ CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" -+endif -+ #to copy to tmux clipboard: -CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" +#CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" diff --git a/app-office/sc-im/sc-im-0.8.2.ebuild b/app-office/sc-im/sc-im-0.8.2.ebuild index 3c1ab1a27f..ddccd6cb41 100644 --- a/app-office/sc-im/sc-im-0.8.2.ebuild +++ b/app-office/sc-im/sc-im-0.8.2.ebuild @@ -5,7 +5,7 @@ EAPI=7 LUA_COMPAT=( lua5-1 luajit ) -inherit lua-single toolchain-funcs +inherit lua-single toolchain-funcs flag-o-matic DESCRIPTION="Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal" HOMEPAGE="https://github.com/andmarti1424/sc-im" @@ -51,17 +51,6 @@ BDEPEND="virtual/pkgconfig" S="${WORKDIR}/${P}/src" pkg_setup() { - export X=$(usex X) - export TMUX=$(usex tmux) - export WAYLAND=$(usex wayland) - export PLOTS=$(usex plots) - export XLS=$(usex xls) - export XLSX=$(usex xlsx) - export LUA=$(usex lua) - ( use xlsx || use ods ) && export XML_ZIP="yes" - - # Notifying the user about which clipboard support is enabled if conflicting flags are set - # Prefer wayland support over X, and tmux support over both wayland and X. CONFLICTING=$(usex tmux "tmux " "")$(usex wayland "wayland " "")$(usex X "X" "") if ( use tmux && ( use wayland || use X ) ) ; then elog "Conflicting flags for clipboard support are set: ${CONFLICTING}" @@ -77,5 +66,38 @@ pkg_setup() { src_configure() { tc-export CC - default + + PKGCONF=$(tc-getPKG_CONFIG) + + if use tmux ; then + append-cflags '-DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\"' + append-cflags '-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\"' + elif use wayland ; then + append-cflags '-DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""wl-copy <"\"' + append-cflags '-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""wl-paste"\"' + elif use X ; then + append-cflags '-DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\"' + append-cflags '-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\"' + fi + + use plots && append-cflags -DGNUPLOT + if use xls; then + append-cflags -DXLS $(${PKGCONF} --cflags libxls) + LDLIBS+=" $(${PKGCONF} --libs libxls)" + fi + if use xlsx || use ods ; then + append-cflags -DODS -DXLSX $(${PKGCONF} --cflags libxml-2.0 libzip) + LDLIBS+=" -DODS -DXLSX $(${PKGCONF} --libs libxml-2.0 libzip)" + fi + if use xlsx ; then + append-cflags -DXLSX_EXPORT $(${PKGCONF} --cflags xlsxwriter) + LDLIBS+=" -DXLSX_EXPORT $(${PKGCONF} --libs xlsxwriter)" + fi + if use lua ; then + append-cflags -DXLUA $(${PKGCONF} --cflags lua) + LDLIBS+=" -DXLUA $(${PKGCONF} --libs lua) -rdynamic" + fi + append-cflags $(${PKGCONF} --cflags ncursesw) || append-cflags $(${PKGCONF} --cflags ncurses) + LDLIBS+=" $(${PKGCONF} --libs ncursesw)" || LDLIBS+=" $(${PKGCONF} --libs ncurses)" + export LDLIBS }