From 054390fe89008990cf541508a0d2e987df943db2 Mon Sep 17 00:00:00 2001 From: Dex Conner Date: Tue, 26 Apr 2022 15:34:54 +0300 Subject: [PATCH] app-office/sc-im: move all flags to the ebuild Moved all CFLAGS and LDLIBS arguments to the ebuild from the Makefile and removed the patches that "fixed" the automagic dependencies / clipboard commands / installation prefix. Now all is handled from within the ebuild. Signed-off-by: Dex Conner --- .../sc-im/files/sc-im-0.8.2-automagic.patch | 92 ------------------- .../sc-im/files/sc-im-0.8.2-clipboard.patch | 20 ---- .../sc-im/files/sc-im-0.8.2-prefix.patch | 11 --- app-office/sc-im/sc-im-0.8.2-r1.ebuild | 54 +++++++++-- 4 files changed, 47 insertions(+), 130 deletions(-) delete mode 100644 app-office/sc-im/files/sc-im-0.8.2-automagic.patch delete mode 100644 app-office/sc-im/files/sc-im-0.8.2-clipboard.patch delete mode 100644 app-office/sc-im/files/sc-im-0.8.2-prefix.patch 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 deleted file mode 100644 index 6ff1aeced7..0000000000 --- a/app-office/sc-im/files/sc-im-0.8.2-automagic.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- src/Makefile -+++ src/Makefile -@@ -82,11 +82,6 @@ - LDLIBS += -pthread - endif - --# Check for gnuplot existance --ifneq (, $(shell which gnuplot)) -- CFLAGS += -DGNUPLOT --endif -- - # OpenBSD does not implement wordexp() - ifeq ($(shell uname -s),OpenBSD) - CFLAGS += -DNO_WORDEXP -@@ -97,77 +92,6 @@ - LDLIBS += -ldl - endif - --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) -- 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) -- 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) -- 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 -- 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) -- LDLIBS += $(shell pkg-config --libs luajit) -Wl,--export-dynamic -- else -- LDLIBS += $(shell pkg-config --libs luajit) -rdynamic -- endif -- 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 deleted file mode 100644 index 2668e7d294..0000000000 --- a/app-office/sc-im/files/sc-im-0.8.2-clipboard.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- src/Makefile -+++ src/Makefile -@@ -58,7 +58,7 @@ - # Choose one of the following commands for copying to different clipboards: - # You can later change it at runtime. - #to copy to tmux clipboard: --CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" -+#CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\" - #to copy to X clipboard: - #CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" - #to copy to OSX clipboard: -@@ -66,7 +77,7 @@ - # - # Choose one of the proposed commands for pasting from different clipboards: - # You can later change it at runtime. --CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\" -+#CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\" - #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" - #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""pbpaste"\" - diff --git a/app-office/sc-im/files/sc-im-0.8.2-prefix.patch b/app-office/sc-im/files/sc-im-0.8.2-prefix.patch deleted file mode 100644 index c34d226c2e..0000000000 --- a/app-office/sc-im/files/sc-im-0.8.2-prefix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- src/Makefile -+++ src/Makefile -@@ -2,7 +2,7 @@ - name = sc-im - - # The base directory where everything should be installed. --prefix = /usr/local -+prefix = /usr - - EXDIR = $(prefix)/bin - HELPDIR = $(prefix)/share/$(name) diff --git a/app-office/sc-im/sc-im-0.8.2-r1.ebuild b/app-office/sc-im/sc-im-0.8.2-r1.ebuild index 15abb065dd..d95a385a13 100644 --- a/app-office/sc-im/sc-im-0.8.2-r1.ebuild +++ b/app-office/sc-im/sc-im-0.8.2-r1.ebuild @@ -17,12 +17,6 @@ KEYWORDS="~amd64 ~x86" IUSE="X plots wayland xls xlsx lua ods tmux" REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )" -PATCHES=( - "${FILESDIR}/${P}-prefix.patch" - "${FILESDIR}/${P}-automagic.patch" - "${FILESDIR}/${P}-clipboard.patch" -) - DEPEND=" sys-libs/ncurses @@ -64,11 +58,48 @@ pkg_setup() { lua-single_pkg_setup } +src_prepare() { + default + + # Clean Makefile from all sorts of flag / lib setting + sed -i -e '/CFLAGS +=\|LDLIBS +=/d' Makefile \ + || die "sed fix failed. Uh-oh..." + # Also clean the now useless comments and logic + sed -i -e '/#\|if\|else/d' Makefile \ + || die "sed fix failed. Uh-oh..." +} + src_configure() { tc-export CC PKGCONF=$(tc-getPKG_CONFIG) + LDLIBS="-lm" + + # default flags that dont need optional dependencies + append-cflags -Wall -g \ + -DNCURSES \ + -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE \ + '-DSNAME=\"sc-im\"' \ + '-DHELP_PATH=\"/usr/share/sc-im\"' \ + '-DLIBDIR=\"/usr/share/doc/sc-im\"' \ + '-DDFLT_PAGER=\"less\"' \ + '-DDFLT_EDITOR=\"vim\"' \ + -DUSECOLORS \ + '-DHISTORY_FILE=\"sc-iminfo\"' \ + '-DHISTORY_DIR=\".cache\"' \ + '-DCONFIG_FILE=\"scimrc\"' \ + '-DCONFIG_DIR=\".config/sc-im\"' \ + '-DINS_HISTORY_FILE=\"sc-iminfo\"' \ + -DUNDO \ + -DMAXROWS=65536 \ + -DUSELOCALE \ + -DMOUSE \ + '-DDEFAULT_OPEN_FILE_UNDER_CURSOR_CMD=\""scopen"\"' \ + -DAUTOBACKUP \ + -DHAVE_PTHREAD + + # setting default clipboard commands if use tmux ; then append-cflags '-DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\"' append-cflags '-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\"' @@ -80,6 +111,7 @@ src_configure() { append-cflags '-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\"' fi + # optional feature dependency use plots && append-cflags -DGNUPLOT if use xls; then append-cflags -DXLS $(${PKGCONF} --cflags libxls) @@ -99,5 +131,13 @@ src_configure() { fi append-cflags $(${PKGCONF} --cflags ncursesw) || append-cflags $(${PKGCONF} --cflags ncurses) LDLIBS+=" $(${PKGCONF} --libs ncursesw)" || LDLIBS+=" $(${PKGCONF} --libs ncurses)" - export LDLIBS +} + +src_compile() { + emake LDLIBS="${LDLIBS}" CFLAGS="${CFLAGS}" +} + +src_install() { + emake DESTDIR="${D}" prefix="/usr" install + einstalldocs }