crux-musl

Unnamed repository; edit this file 'description' to name the repository.
git clone https://codeberg.org/emmett1/crux-musl
Log | Files | Refs | README | LICENSE

fix-static-link.patch (2824B)


      1 diff --git a/Makefile b/Makefile
      2 index bcd092d..7281724 100644
      3 --- a/Makefile
      4 +++ b/Makefile
      5 @@ -184,7 +184,7 @@ else
      6  	ECHO=:
      7  endif
      8  
      9 -OBJS = mdadm.o config.o policy.o mdstat.o  ReadMe.o uuid.o util.o maps.o lib.o udev.o \
     10 +OBJS = mdadm.o policy.o mdstat.o  ReadMe.o uuid.o util.o maps.o lib.o udev.o \
     11         Manage.o Assemble.o Build.o \
     12         Create.o Detail.o Examine.o Grow.o mdmonitor.o dlink.o Kill.o Query.o \
     13         Incremental.o Dump.o \
     14 @@ -208,8 +208,10 @@ MON_OBJS = mdmon.o monitor.o managemon.o uuid.o util.o maps.o mdstat.o sysfs.o c
     15  
     16  MON_SRCS = $(patsubst %.o,%.c,$(MON_OBJS))
     17  
     18 -STATICSRC = pwgr.c
     19 -STATICOBJS = pwgr.o
     20 +# STATICSRC = pwgr.c
     21 +# STATICOBJS = pwgr.o
     22 +STATICOBJS = config_static.o
     23 +SHAREDOBJS = config_shared.o
     24  
     25  all : mdadm mdmon
     26  man : mdadm.man md.man mdadm.conf.man mdmon.man raid6check.man
     27 @@ -231,8 +233,14 @@ everything-test: all swap_super test_stripe \
     28  %.o: %.c
     29  	$(CC) $(CFLAGS) $(CPPFLAGS) $(COVERITY_FLAGS) -o $@ -c $<
     30  
     31 -mdadm : $(OBJS) | check_rundir
     32 -	$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
     33 +config_shared.o: config.c
     34 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(COVERITY_FLAGS) -o $@ -c $<
     35 +
     36 +config_static.o: config.c
     37 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(COVERITY_FLAGS) -D_MDADM_PRIV_STATIC -o $@ -c $<
     38 +
     39 +mdadm : $(OBJS) $(SHAREDOBJS) | check_rundir
     40 +	$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(SHAREDOBJS) $(LDLIBS)
     41  
     42  mdadm.static : $(OBJS) $(STATICOBJS)
     43  	$(CC) $(CFLAGS) $(LDFLAGS) -static -o mdadm.static $(OBJS) $(STATICOBJS) $(LDLIBS)
     44 @@ -353,7 +361,7 @@ test: mdadm mdmon test_stripe swap_super raid6check
     45  	@echo "Please run './test' as root"
     46  
     47  clean :
     48 -	rm -f mdadm mdmon $(OBJS) $(MON_OBJS) $(STATICOBJS) core *.man \
     49 +	rm -f mdadm mdmon $(OBJS) $(MON_OBJS) $(STATICOBJS) $(SHAREDOBJS) core *.man \
     50  	mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt \
     51  	.merge_file_* mdadm.Os mdadm.O2 mdmon.O2 swap_super init.cpio.gz \
     52  	mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon mdadm.8
     53 diff --git a/config.c b/config.c
     54 index 8a8ae5e..1dd7d55 100644
     55 --- a/config.c
     56 +++ b/config.c
     57 @@ -421,12 +421,14 @@ static void createline(char *line)
     58  			}
     59  			createinfo.uid = strtoul(w + 6, &ep, 10);
     60  			if (*ep != 0) {
     61 +#if !defined(_MDADM_PRIV_STATIC)
     62  				struct passwd *pw;
     63  				/* must be a name */
     64  				pw = getpwnam(w + 6);
     65  				if (pw)
     66  					createinfo.uid = pw->pw_uid;
     67  				else
     68 +#endif
     69  					pr_err("CREATE user %s not found\n",
     70  					       w + 6);
     71  			}
     72 @@ -437,12 +439,14 @@ static void createline(char *line)
     73  			}
     74  			createinfo.gid = strtoul(w + 6, &ep, 10);
     75  			if (*ep != 0) {
     76 +#if !defined(_MDADM_PRIV_STATIC)
     77  				struct group *gr;
     78  				/* must be a name */
     79  				gr = getgrnam(w + 6);
     80  				if (gr)
     81  					createinfo.gid = gr->gr_gid;
     82  				else
     83 +#endif
     84  					pr_err("CREATE group %s not found\n",
     85  					       w + 6);
     86  			}