You are not logged in.
Edit: I apologise, this belongs in "Creating & Modifying Packages" rather... If a mod could please move this I'd be grateful. Sorry for using your time!
Hi all,
I took over the AUR packages libcs50 and libcs50-git, and am here to ask for some assistance to make them better.
Any tips are welcome, of course.
In the upstream Makefile, CFLAGS and LDFLAGS ("LINKER_FLAGS") are set: see lines 12 and 30 and 39-40, if I am not mistaken. This, I gather, bypasses the CFLAGS and LDFLAGS on the machine that you're building the package on. This results in namcap spewing warnings about no RELRO.
I have no background in software or building software. Still, I poked around the Makefile a bit after searching on these forums, and came up with the following patch ("diff -u Makefile Makefile.old > Makefile-FLAGS.patch"):
--- Makefile 2024-01-17 16:45:50.820032476 +0200
+++ Makefile.old 2024-01-17 16:50:35.989535760 +0200
@@ -9,7 +9,7 @@
INCLUDE := src/cs50.h
MANS := $(wildcard docs/*.3.gz)
-CFLAGS=-Wall -Wextra -Werror -pedantic -std=c11
+CFLAGS+=-Wall -Wextra -Werror -pedantic -std=c11
BASENAME=libcs50
LIB_STATIC=$(BASENAME).a
LIB_OBJ=$(BASENAME).o
@@ -36,8 +36,8 @@
all: $(LIBS) $(MANS)
$(LIBS): $(SRC) $(INCLUDE) Makefile
- $(CC) $(CFLAGS) -fPIC -shared $(LINKER_FLAGS) -o $(LIB_VERSION) $(SRC)
- $(CC) $(CFLAGS) -c -o $(LIB_OBJ) $(SRC)
+ $(CC) $(CFLAGS) -fPIC -shared $(LINKER_FLAGS) -o $(LIB_VERSION) $(SRC) ${LDFLAGS}
+ $(CC) $(CFLAGS) -c -o $(LIB_OBJ) $(SRC) $(LDFLAGS)
ar rcs $(LIB_STATIC) $(LIB_OBJ)
chmod 644 $(LIB_STATIC)
rm -f $(LIB_OBJ)
Is this a correct way to add the build-system's CFLAGS and LDFLAGS for building libcs50(,-git)?
Next question: If so, would this be something to suggest to upstream, or is it good practice to bypass the build system's flags, and to impose your own? I just ran with namcap's warnings and things I read on the forum, which heavily suggest that this should be reported upstream. Still, being a complete noob, I rather check before bother upstream.
Thank you for your time and for teaching me!
Last edited by lquidfire (2024-01-18 07:16:06)
Offline
see lines 12 and 30 and 39-40, if I am not mistaken.
line 30 is used on mac systems, line 24 is what's used on linux.
This, I gather, bypasses the CFLAGS and LDFLAGS on the machine that you're building the package on
yup, those in the makefile override the local settings .
There may be specific reasons why upstream uses their own set flags, and this library appears to have a very specific usecase.
The cnrdrvcups-lb aur package I maintain has a similar issue.
its upstream doesn't accept tickets for unsupported distros and as far as I know the supported distros do not change the upstream flags.
So my package also doesn't change the flags.
I suggest asking upstream about those flags and not changing them unless there's confirmation archlinux distro flags don't impact functionality of the library.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline
Dank je for your reply, Lone_Wolf.
I have contacted upstream to find out of RELRO would inhibit the software's functionality, and what they think of adding their flags to local flags, instead of replacing local ones.
Offline