URI:
       build: Use better config-musl target - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 42b50c811c8ad0f6db4fca6088bc67f33cce224e
   DIR parent 5042ac1a04b0b0e797f20fb56d9e377870d513c7
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
       Date:   Mon, 16 Feb 2026 16:53:25 +0100
       
       build: Use better config-musl target
       
       The config-musl target was a helper to make easier to configure scc
       with a musl external libc, but it failed in native musl distributions
       like for example alpine. This new target is expected to be more robust
       and work in native and non native distributions.
       
       Diffstat:
         M Makefile                            |       7 +------
         M README                              |       2 +-
         M include/scc/bits/scc/sys-musl.h     |      11 ++++++-----
         A scripts/muslcfg                     |      17 +++++++++++++++++
       
       4 files changed, 25 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       @@ -31,12 +31,7 @@ config: scripts/scc-make FORCE
                @$(SCCMAKE) -f main.mk config
        
        config-musl: scripts/scc-make FORCE
       -        $(SCCMAKE) LIBPROFILE=musl config
       -        gcc -v 2>&1 |\
       -        sed -En '/COLLECT_LTO_WRAPPER=/ s/.*=(.*)\/lto-wrapper/\1/p' |\
       -        (read -r path; \
       -         printf "g/define GCCLIBPATH/ s@.*@#define GCCLIBPATH \"$$path/\"@\nw\n") |\
       -        ed -s include/scc/bits/scc/sys.h
       +        scripts/muslcfg
        
        clean: FORCE
                touch config.mk
   DIR diff --git a/README b/README
       @@ -256,7 +256,7 @@ programs. Scc includes a template that can be used to use a musl libc
        compiled by gcc, and to make easier to get the correct values it also
        provides a specific target to configure scc for a correct support for musl:
        
       -        $ make LIBPREFIX=/usr/local/musl config-musl
       +        $ make config-musl
                $ make
                $ make install
        
   DIR diff --git a/include/scc/bits/scc/sys-musl.h b/include/scc/bits/scc/sys-musl.h
       @@ -1,15 +1,16 @@
        #define LDBIN "ld"
        #define ASBIN "as"
        
       +/* configure below your system linker command line */
       +#define GCCLIBPATH "/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2/"
       +
        /* configure below your standard sys include paths */
        char *sysincludes[] = {
       +        LIBPREFIX "/include",
                "%p/include/",
                NULL
        };
        
       -/* configure below your system linker command line */
       -#define GCCLIBPATH "/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2/"
       -
        char *ldcmd[] = {
                "-static",
                "-z","nodefaultlib",
       @@ -19,9 +20,9 @@ char *ldcmd[] = {
                "-L",GCCLIBPATH,
                "%p/lib/Scrt1.o",
                "%p/lib/crti.o",
       -        GCCLIBPATH "crtbeginS.o",
       +        GCCLIBPATH "/crtbeginS.o",
                "%c",
       -        GCCLIBPATH "crtendS.o",
       +        GCCLIBPATH "/crtendS.o",
                "%p/lib/crtn.o",
                "-lc",
                "-lgcc",
   DIR diff --git a/scripts/muslcfg b/scripts/muslcfg
       @@ -0,0 +1,17 @@
       +#!/bin/sh
       +
       +gcc -v 2>&1 |
       +      tr ' ' '\n' |
       +      sed -En '
       +        /COLLECT_LTO_WRAPPER/ s@.*(gcc.*)/lto-wrapper@path=\1@p
       +        /--prefix=/ s/^--//p
       +        $ a\
       +gcclibpath=\\"$prefix/lib/$path\\"\
       +libprefix=$prefix\
       +${SCCMAKE-make} LIBPREFIX=$prefix LIBPROFILE=musl config \
       +(printf "g/define GCCLIBPATH/ s@.*@#define GCCLIBPATH $gcclibpath@\\n"\
       + printf "g/LIBPREFIX/ s@@\\"$prefix\\"@\\nw\\n") |\
       +ed -s include/scc/bits/scc/sys.h\
       +printf "g/LIBPREFIX/ s@=.*@=$prefix@\\nw\\n" |\
       +ed -s config.mk
       +' | sh