From nobody Thu Apr 25 17:59:38 2024 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VQNt0660Cz5JDyh for ; Thu, 25 Apr 2024 17:59:52 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VQNt049tRz4TF5 for ; Thu, 25 Apr 2024 17:59:52 +0000 (UTC) (envelope-from tomek@cedro.info) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-6114c9b4d83so11341237b3.3 for ; Thu, 25 Apr 2024 10:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; t=1714067991; x=1714672791; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ewetL4WQCHIL+5+7jaj3v0/QWVcAzjXawRHnmmjvN5s=; b=ACWXLSpTOArlhYU5EkXQOXD0D3TCyG4vHvNvO5aoqUanPYCD53waM+S9knQ0pCl2kP eTkSZLpI2JLa8PdW4DZdpj/pnD/5B2u8hsUbC4iND9fLhHI7fRTrLWSCbZBQd4XWGtDb T3jQXaupRopmIOVkWtxwM9XTSzSEX1xwNMAh5TD02IgYVdo7RRTTUsMdh9kgkBK04uyD b9Zom56LO77UN00I6nmDeXobEdWBFWvEAsNUddAd6QjaJuxm/Kdvick5ya35YGMw+NAc 8Keq59xgIRnb51YdIWbiWamATPqZkqRUzh6tttOldEstFGGsQhGWoHX6KP6XBPyNPFL2 ALAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714067991; x=1714672791; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ewetL4WQCHIL+5+7jaj3v0/QWVcAzjXawRHnmmjvN5s=; b=XDpoiU+FAEaSqwW4fkk92kLODaBlln7UOfYrcFUL7XCZX46Q8G9I1FO4nmGi8V0ZdO YgfbXCQsEYcWkoUXaIa9omCevKwotxCdSWbdRWY7tt1voZyqo/x7IVfMgfRf0O48OvuX yXYrpet6Z8cDlhuaTY9U2PObCnTLz9HlxnT+C3+cXr1Etiqsqb5iUQD0cCzyDi41igOb 7c01ayTku51gLOK/+5No8g0d1kT0UAhKtihhzBNHftbLqsTZOfGVuazb3uBeLwGGQv5T s8TGfqEdg7xFZq9nQ6MvrVuu/TJZqJo/G0m7atwUpGoTtsPHGQkdInTiR5wHiXordxDk hkNw== X-Gm-Message-State: AOJu0YxIhXwdjAhY8pl0HEgadBKvuwz0zixyFMpMQn/U4ldTEGrSSwPz LFACAr9mKvLrQXiMnHY81eOTaHKIZBlPJsanx5YV5QShrPoUy2a0lHa/I5w5hg== X-Google-Smtp-Source: AGHT+IHrhRY6BQEJlBVgWNGs1Wl5npVxP27jM7dGU4Gh9yh0094VD92W+yRO6zDi7s/usy3Kr1wSCQ== X-Received: by 2002:a05:690c:387:b0:61b:33b7:9e11 with SMTP id bh7-20020a05690c038700b0061b33b79e11mr302525ywb.9.1714067991457; Thu, 25 Apr 2024 10:59:51 -0700 (PDT) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com. [209.85.219.170]) by smtp.gmail.com with ESMTPSA id w2-20020a814902000000b0061ac30230bfsm3686249ywa.49.2024.04.25.10.59.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Apr 2024 10:59:50 -0700 (PDT) Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-db4364ecd6aso1473855276.2; Thu, 25 Apr 2024 10:59:50 -0700 (PDT) X-Received: by 2002:a25:3602:0:b0:de5:a249:2c5e with SMTP id d2-20020a253602000000b00de5a2492c5emr415982yba.43.1714067990127; Thu, 25 Apr 2024 10:59:50 -0700 (PDT) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 References: <493f8ca1-75e1-4ae6-8641-5998c53457cb@FreeBSD.org> In-Reply-To: <493f8ca1-75e1-4ae6-8641-5998c53457cb@FreeBSD.org> From: Tomek CEDRO Date: Thu, 25 Apr 2024 19:59:38 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bsd sed / make vs bsd sed / make To: Kyle Evans Cc: questions@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4VQNt049tRz4TF5 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