Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2024 19:59:38 +0200
From:      Tomek CEDRO <tomek@cedro.info>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        questions@freebsd.org
Subject:   Re: bsd sed / make vs bsd sed / make
Message-ID:  <CAFYkXj=nRJ6VRV=nVab12zT=MdM_x=uTaWnHk1KSh==5p8p2dg@mail.gmail.com>
In-Reply-To: <493f8ca1-75e1-4ae6-8641-5998c53457cb@FreeBSD.org>
References:  <CAFYkXjnq7LB3mhnK4vtQ0p_YJfSU5OOCWgcF6sm64FTCN8gF8Q@mail.gmail.com> <493f8ca1-75e1-4ae6-8641-5998c53457cb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 25, 2024 at 7:43=E2=80=AFPM Kyle Evans wrote:
> On 4/25/24 12:36, Tomek CEDRO wrote:
> > sed -e '/=3D=3D=3D=3D/,/=3D=3D=3D=3D/!d;//d' -e 's/__executable_start/_=
stext/g' \
> >       -e 's/^\(\s\+\)\(\.init_array\)/\1\2 : { }\n\1.sinit/g' \
> >       -e 's/^\(\s\+\)\(\.fini_array\)/\1\2 : { }\n\1.einit/g' \
> >       -e 's/__init_array_start/_sinit/g' -e 's/__init_array_end/_einit/=
g' \
> >       -e 's/__fini_array_start/_sfini/g' -e
> > 's/__fini_array_end/_efini/g' >nuttx.ld
>
> Everything about this is cursed.  IMO you should propose switching these
> to EREs (-E) and fixing all of the escaped things as appropriate for
> that switch, then substituting [[:space:]] in for \s to make them
> compliant expressions.

Thanks Kyle :-) With ERE it would work both with sed and gsed? I will
have to learn sed + ere then.. any good references out there? :-)


> > It does not work with BSD sed but when I replace this with gsed all wor=
ks fine.
> > BSD sed complalins about trailinig backslash:
> > sed: 1: "s/^\(\s\+\)\(\.init_arr ...": RE error: trailing backslash (\)
> > Is there a way to fix that part so it works both with GNU sed and BSD
> > sed? The easiest way would be adding ${SEDCMD} set to "gsed" on BSD
> > and "sed" for the others (macOS also seems to use gnu sed).
>
> The ports infrastructure also has a BINARY_ALIAS that can be used to
> install gsed as sed for just this build, assuming nothing that uses
> these 'enhanced' expressions hardcodes a path to sed.

Well it will not be a port just local git clone bootstrapped per
project. No hardcoded paths to sed luckily :-) Just wondering what are
the best practices to turn BSD make run GNU make a simple bsd only
makefile that would wrap make wall with gmake or something ? Not
really a big problem I can use it with gmake just want to make life
easier for other users :-)

Thanks! :-)
Tomek

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFYkXj=nRJ6VRV=nVab12zT=MdM_x=uTaWnHk1KSh==5p8p2dg>