head 1.107; access; symbols pkgsrc-2023Q4:1.107.0.6 pkgsrc-2023Q4-base:1.107 pkgsrc-2023Q3:1.107.0.4 pkgsrc-2023Q3-base:1.107 pkgsrc-2023Q2:1.107.0.2 pkgsrc-2023Q2-base:1.107 pkgsrc-2023Q1:1.106.0.4 pkgsrc-2023Q1-base:1.106 pkgsrc-2022Q4:1.106.0.2 pkgsrc-2022Q4-base:1.106 pkgsrc-2022Q3:1.105.0.2 pkgsrc-2022Q3-base:1.105 pkgsrc-2022Q2:1.104.0.10 pkgsrc-2022Q2-base:1.104 pkgsrc-2022Q1:1.104.0.8 pkgsrc-2022Q1-base:1.104 pkgsrc-2021Q4:1.104.0.6 pkgsrc-2021Q4-base:1.104 pkgsrc-2021Q3:1.104.0.4 pkgsrc-2021Q3-base:1.104 pkgsrc-2021Q2:1.104.0.2 pkgsrc-2021Q2-base:1.104 pkgsrc-2021Q1:1.103.0.4 pkgsrc-2021Q1-base:1.103 pkgsrc-2020Q4:1.103.0.2 pkgsrc-2020Q4-base:1.103 pkgsrc-2020Q3:1.102.0.2 pkgsrc-2020Q3-base:1.102 pkgsrc-2020Q2:1.101.0.2 pkgsrc-2020Q2-base:1.101 pkgsrc-2020Q1:1.73.0.2 pkgsrc-2020Q1-base:1.73 pkgsrc-2019Q4:1.62.0.4 pkgsrc-2019Q4-base:1.62 pkgsrc-2019Q3:1.61.0.2 pkgsrc-2019Q3-base:1.61 pkgsrc-2019Q2:1.60.0.2 pkgsrc-2019Q2-base:1.60 pkgsrc-2019Q1:1.59.0.2 pkgsrc-2019Q1-base:1.59 pkgsrc-2018Q4:1.58.0.2 pkgsrc-2018Q4-base:1.58 pkgsrc-2018Q3:1.56.0.6 pkgsrc-2018Q3-base:1.56 pkgsrc-2018Q2:1.56.0.4 pkgsrc-2018Q2-base:1.56 pkgsrc-2018Q1:1.56.0.2 pkgsrc-2018Q1-base:1.56 pkgsrc-2017Q4:1.55.0.18 pkgsrc-2017Q4-base:1.55 pkgsrc-2017Q3:1.55.0.16 pkgsrc-2017Q3-base:1.55 pkgsrc-2017Q2:1.55.0.12 pkgsrc-2017Q2-base:1.55 pkgsrc-2017Q1:1.55.0.10 pkgsrc-2017Q1-base:1.55 pkgsrc-2016Q4:1.55.0.8 pkgsrc-2016Q4-base:1.55 pkgsrc-2016Q3:1.55.0.6 pkgsrc-2016Q3-base:1.55 pkgsrc-2016Q2:1.55.0.4 pkgsrc-2016Q2-base:1.55 pkgsrc-2016Q1:1.55.0.2 pkgsrc-2016Q1-base:1.55 pkgsrc-2015Q4:1.54.0.18 pkgsrc-2015Q4-base:1.54 pkgsrc-2015Q3:1.54.0.16 pkgsrc-2015Q3-base:1.54 pkgsrc-2015Q2:1.54.0.14 pkgsrc-2015Q2-base:1.54 pkgsrc-2015Q1:1.54.0.12 pkgsrc-2015Q1-base:1.54 pkgsrc-2014Q4:1.54.0.10 pkgsrc-2014Q4-base:1.54 pkgsrc-2014Q3:1.54.0.8 pkgsrc-2014Q3-base:1.54 pkgsrc-2014Q2:1.54.0.6 pkgsrc-2014Q2-base:1.54 pkgsrc-2014Q1:1.54.0.4 pkgsrc-2014Q1-base:1.54 pkgsrc-2013Q4:1.54.0.2 pkgsrc-2013Q4-base:1.54 pkgsrc-2013Q3:1.53.0.50 pkgsrc-2013Q3-base:1.53 pkgsrc-2013Q2:1.53.0.48 pkgsrc-2013Q2-base:1.53 pkgsrc-2013Q1:1.53.0.46 pkgsrc-2013Q1-base:1.53 pkgsrc-2012Q4:1.53.0.44 pkgsrc-2012Q4-base:1.53 pkgsrc-2012Q3:1.53.0.42 pkgsrc-2012Q3-base:1.53 pkgsrc-2012Q2:1.53.0.40 pkgsrc-2012Q2-base:1.53 pkgsrc-2012Q1:1.53.0.38 pkgsrc-2012Q1-base:1.53 pkgsrc-2011Q4:1.53.0.36 pkgsrc-2011Q4-base:1.53 pkgsrc-2011Q3:1.53.0.34 pkgsrc-2011Q3-base:1.53 pkgsrc-2011Q2:1.53.0.32 pkgsrc-2011Q2-base:1.53 pkgsrc-2011Q1:1.53.0.30 pkgsrc-2011Q1-base:1.53 pkgsrc-2010Q4:1.53.0.28 pkgsrc-2010Q4-base:1.53 pkgsrc-2010Q3:1.53.0.26 pkgsrc-2010Q3-base:1.53 pkgsrc-2010Q2:1.53.0.24 pkgsrc-2010Q2-base:1.53 pkgsrc-2010Q1:1.53.0.22 pkgsrc-2010Q1-base:1.53 pkgsrc-2009Q4:1.53.0.20 pkgsrc-2009Q4-base:1.53 pkgsrc-2009Q3:1.53.0.18 pkgsrc-2009Q3-base:1.53 pkgsrc-2009Q2:1.53.0.16 pkgsrc-2009Q2-base:1.53 pkgsrc-2009Q1:1.53.0.14 pkgsrc-2009Q1-base:1.53 pkgsrc-2008Q4:1.53.0.12 pkgsrc-2008Q4-base:1.53 pkgsrc-2008Q3:1.53.0.10 pkgsrc-2008Q3-base:1.53 cube-native-xorg:1.53.0.8 cube-native-xorg-base:1.53 pkgsrc-2008Q2:1.53.0.6 pkgsrc-2008Q2-base:1.53 cwrapper:1.53.0.4 pkgsrc-2008Q1:1.53.0.2 pkgsrc-2008Q1-base:1.53 pkgsrc-2007Q4:1.48.0.2 pkgsrc-2007Q4-base:1.48 pkgsrc-2007Q3:1.46.0.6 pkgsrc-2007Q3-base:1.46 pkgsrc-2007Q2:1.46.0.4 pkgsrc-2007Q2-base:1.46 pkgsrc-2007Q1:1.46.0.2 pkgsrc-2007Q1-base:1.46 jlam-pkgviews:1.45.0.2 jlam-pkgviews-base:1.45 pkgsrc-2006Q4:1.38.0.2 pkgsrc-2006Q4-base:1.38 pkgsrc-2006Q3:1.35.0.2 pkgsrc-2006Q3-base:1.35 pkgsrc-2006Q2:1.34.0.2 pkgsrc-2006Q2-base:1.34 tv-derecurse-eol:1.16.4.1 pkgsrc-2006Q1:1.32.0.2 pkgsrc-2006Q1-base:1.32 pkgsrc-2005Q4:1.26.0.2 pkgsrc-2005Q4-base:1.26 pkgsrc-2005Q3:1.23.0.2 pkgsrc-2005Q3-base:1.23 pkgsrc-2005Q2:1.22.0.2 pkgsrc-2005Q2-base:1.22 tv-derecurse-merge:1.17 pkgsrc-2005Q1:1.16.0.8 pkgsrc-2005Q1-base:1.16 pkgsrc-2004Q4:1.16.0.6 pkgsrc-2004Q4-base:1.16 tv-derecurse:1.16.0.4 tv-derecurse-base:1.16 pkgsrc-2004Q3:1.16.0.2 pkgsrc-2004Q3-base:1.16 pkgsrc-2004Q2:1.12.0.2 pkgsrc-2004Q2-base:1.12 pkgsrc-2004Q1:1.11.0.2 pkgsrc-2004Q1-base:1.11 pkgsrc-2003Q4:1.3.0.2 pkgsrc-2003Q4-base:1.3 pkgviews-mk-base:1.1 pkgviews-mk:1.1.0.2; locks; strict; comment @# @; 1.107 date 2023.03.29.10.57.16; author rillig; state Exp; branches; next 1.106; commitid vq7ZQlIS3XYvB0jE; 1.106 date 2022.11.23.10.53.14; author jperkin; state Exp; branches; next 1.105; commitid fwaKRNnKEaQECO2E; 1.105 date 2022.07.06.20.59.51; author rillig; state Exp; branches; next 1.104; commitid GwCoI7KZ4cJkuSKD; 1.104 date 2021.05.19.14.44.22; author triaxx; state Exp; branches; next 1.103; commitid nYFWr7wj7fiLELTC; 1.103 date 2020.10.06.17.48.02; author rillig; state Exp; branches; next 1.102; commitid aLcTAq4QRl2TURqC; 1.102 date 2020.06.29.18.04.13; author rillig; state Exp; branches; next 1.101; commitid V8k1AC7YSZcac9eC; 1.101 date 2020.06.25.08.45.00; author jperkin; state Exp; branches; next 1.100; commitid 15SR9pTKwBVudAdC; 1.100 date 2020.06.16.18.13.54; author rillig; state Exp; branches; next 1.99; commitid zLxkiGA2Fd7PEtcC; 1.99 date 2020.06.11.20.13.22; author rillig; state Exp; branches; next 1.98; commitid 2y9JUDrwVViMuQbC; 1.98 date 2020.06.11.19.38.40; author rillig; state Exp; branches; next 1.97; commitid 1DEuRBM4ETNQgQbC; 1.97 date 2020.06.11.19.27.56; author rillig; state Exp; branches; next 1.96; commitid 5S7qL3HEWDn6fQbC; 1.96 date 2020.06.11.18.04.41; author rillig; state Exp; branches; next 1.95; commitid Az2LWkKAjNZBMPbC; 1.95 date 2020.06.03.10.56.46; author gdt; state Exp; branches; next 1.94; commitid JCc2jpprRKt4GLaC; 1.94 date 2020.06.02.23.37.25; author gdt; state Exp; branches; next 1.93; commitid SPsScRI4o3H0VHaC; 1.93 date 2020.05.16.19.02.32; author rillig; state Exp; branches; next 1.92; commitid vI6C7oiHyvTBTu8C; 1.92 date 2020.05.02.05.52.09; author rillig; state Exp; branches; next 1.91; commitid ayUR4eVYfvliZC6C; 1.91 date 2020.05.01.19.53.48; author rillig; state Exp; branches; next 1.90; commitid 0F1x9Mdfh030Iz6C; 1.90 date 2020.05.01.06.42.32; author rillig; state Exp; branches; next 1.89; commitid w5nBtOAKL3Lsjv6C; 1.89 date 2020.04.30.23.52.30; author joerg; state Exp; branches; next 1.88; commitid K9AEKhZwrGbW3t6C; 1.88 date 2020.04.30.23.51.45; author joerg; state Exp; branches; next 1.87; commitid ykIyNEva2hsA3t6C; 1.87 date 2020.04.30.23.51.15; author joerg; state Exp; branches; next 1.86; commitid VXKtLIm8ztHs3t6C; 1.86 date 2020.04.29.22.46.42; author rillig; state Exp; branches; next 1.85; commitid OZ7ysMkzdz79Fk6C; 1.85 date 2020.04.29.18.33.56; author rillig; state Exp; branches; next 1.84; commitid zwlu1FWVJ7kykj6C; 1.84 date 2020.04.23.19.32.53; author rillig; state Exp; branches; next 1.83; commitid mG0G6zZIDGJsQx5C; 1.83 date 2020.04.23.19.30.29; author rillig; state Exp; branches; next 1.82; commitid FVrB1N0iv2S0Qx5C; 1.82 date 2020.04.23.19.16.49; author rillig; state Exp; branches; next 1.81; commitid 0RHE46fxhLI9Lx5C; 1.81 date 2020.04.23.19.06.09; author rillig; state Exp; branches; next 1.80; commitid 9j9mQqEBsG17Gx5C; 1.80 date 2020.04.23.18.06.13; author rillig; state Exp; branches; next 1.79; commitid EUSNU3a1GzBQlx5C; 1.79 date 2020.04.18.15.04.34; author rillig; state Exp; branches; next 1.78; commitid zQKdPBKke5eswS4C; 1.78 date 2020.04.18.12.59.43; author rillig; state Exp; branches; next 1.77; commitid yQw00QdBxzVKPR4C; 1.77 date 2020.04.18.12.21.10; author rillig; state Exp; branches; next 1.76; commitid 1QCFeDu9XDKLAR4C; 1.76 date 2020.04.18.11.42.34; author rillig; state Exp; branches; next 1.75; commitid AYPY2eJyTNvnpR4C; 1.75 date 2020.04.18.11.32.01; author rillig; state Exp; branches; next 1.74; commitid mbYjuhArLrpnlR4C; 1.74 date 2020.04.01.15.10.09; author rillig; state Exp; branches; next 1.73; commitid Obvx3I0TwTH66H2C; 1.73 date 2020.03.28.20.39.50; author rillig; state Exp; branches; next 1.72; commitid s783MYWVQ0Cz3d2C; 1.72 date 2020.03.23.11.27.29; author jperkin; state Exp; branches; next 1.71; commitid Nrqgtem8ofrr9w1C; 1.71 date 2020.03.22.18.43.46; author rillig; state Exp; branches; next 1.70; commitid DTAoFxNyaUY4Bq1C; 1.70 date 2020.03.22.13.19.50; author rillig; state Exp; branches; next 1.69; commitid nCK6vw5IAIEhOo1C; 1.69 date 2020.03.22.12.15.59; author rillig; state Exp; branches; next 1.68; commitid rM5NRIBXO3Xwro1C; 1.68 date 2020.03.21.19.26.12; author rillig; state Exp; branches; next 1.67; commitid TYpYJoZzLhsPRi1C; 1.67 date 2020.03.21.13.30.35; author rillig; state Exp; branches; next 1.66; commitid Hq6AXR8jWccOTg1C; 1.66 date 2020.03.21.12.22.31; author rillig; state Exp; branches; next 1.65; commitid Zaa97zlMraANwg1C; 1.65 date 2020.03.20.09.00.44; author rillig; state Exp; branches; next 1.64; commitid aicErvTYgP8Jr71C; 1.64 date 2020.03.20.06.17.48; author rillig; state Exp; branches; next 1.63; commitid 57MwI7j7COLVw61C; 1.63 date 2020.03.19.16.57.35; author rillig; state Exp; branches; next 1.62; commitid 8WBtz2VEbFgX421C; 1.62 date 2019.11.22.18.04.49; author minskim; state Exp; branches; next 1.61; commitid Bqrpi4awhTUnhSLB; 1.61 date 2019.09.08.09.06.06; author rillig; state Exp; branches; next 1.60; commitid NAHgU4FZleYvGbCB; 1.60 date 2019.04.28.12.31.15; author rillig; state Exp; branches; next 1.59; commitid 37fV5ydWJy0t77lB; 1.59 date 2019.03.17.12.01.14; author rillig; state Exp; branches; next 1.58; commitid IchttpLNbcKJiIfB; 1.58 date 2018.11.30.18.38.19; author rillig; state Exp; branches; next 1.57; commitid zBT3EMv4ItD9VZ1B; 1.57 date 2018.10.08.20.35.00; author rillig; state Exp; branches; next 1.56; commitid fTFOJOOJ0Ih6icVA; 1.56 date 2018.01.02.21.18.48; author rillig; state Exp; branches; next 1.55; commitid y5rEMY5oH7t2vllA; 1.55 date 2016.01.31.17.27.41; author rillig; state Exp; branches; next 1.54; commitid mggE58b4FA3eM6Ty; 1.54 date 2013.10.13.21.38.36; author dholland; state Exp; branches; next 1.53; commitid iDUBW9AHkVFJab9x; 1.53 date 2008.01.26.15.23.21; author rillig; state Exp; branches; next 1.52; 1.52 date 2008.01.23.01.44.28; author rillig; state Exp; branches; next 1.51; 1.51 date 2008.01.18.11.26.11; author rillig; state Exp; branches; next 1.50; 1.50 date 2008.01.18.11.16.08; author rillig; state Exp; branches; next 1.49; 1.49 date 2008.01.18.10.41.05; author rillig; state Exp; branches; next 1.48; 1.48 date 2007.11.19.23.38.03; author rillig; state Exp; branches; next 1.47; 1.47 date 2007.11.01.13.12.48; author rillig; state Exp; branches; next 1.46; 1.46 date 2007.04.05.18.33.09; author wiz; state Exp; branches; next 1.45; 1.45 date 2007.03.15.22.54.24; author rillig; state Exp; branches; next 1.44; 1.44 date 2007.03.07.21.27.59; author rillig; state Exp; branches; next 1.43; 1.43 date 2007.02.05.08.39.23; author rillig; state Exp; branches; next 1.42; 1.42 date 2007.01.23.06.05.39; author rillig; state Exp; branches; next 1.41; 1.41 date 2007.01.14.17.05.02; author rillig; state Exp; branches; next 1.40; 1.40 date 2007.01.11.12.12.12; author rillig; state Exp; branches; next 1.39; 1.39 date 2007.01.03.23.35.13; author rillig; state Exp; branches; next 1.38; 1.38 date 2006.12.10.02.25.13; author reed; state Exp; branches; next 1.37; 1.37 date 2006.11.23.16.27.53; author tron; state Exp; branches; next 1.36; 1.36 date 2006.11.09.02.06.29; author rillig; state Exp; branches; next 1.35; 1.35 date 2006.07.02.09.35.05; author rillig; state Exp; branches; next 1.34; 1.34 date 2006.06.22.20.45.48; author rillig; state Exp; branches; next 1.33; 1.33 date 2006.06.17.22.42.00; author rillig; state Exp; branches; next 1.32; 1.32 date 2006.01.08.01.07.35; author rillig; state Exp; branches; next 1.31; 1.31 date 2006.01.07.23.27.41; author rillig; state Exp; branches; next 1.30; 1.30 date 2006.01.07.18.43.05; author rillig; state Exp; branches; next 1.29; 1.29 date 2006.01.05.23.16.01; author joerg; state Exp; branches; next 1.28; 1.28 date 2006.01.01.22.52.16; author rillig; state Exp; branches; next 1.27; 1.27 date 2006.01.01.22.30.35; author rillig; state Exp; branches; next 1.26; 1.26 date 2005.12.06.17.17.30; author rillig; state Exp; branches; next 1.25; 1.25 date 2005.11.24.20.02.40; author rillig; state Exp; branches; next 1.24; 1.24 date 2005.11.17.23.17.02; author rillig; state Exp; branches; next 1.23; 1.23 date 2005.08.21.22.00.07; author rillig; state Exp; branches; next 1.22; 1.22 date 2005.06.09.19.49.48; author rillig; state Exp; branches; next 1.21; 1.21 date 2005.05.20.21.36.05; author jlam; state Exp; branches; next 1.20; 1.20 date 2005.05.20.18.40.42; author jlam; state Exp; branches; next 1.19; 1.19 date 2005.05.18.03.33.51; author rillig; state Exp; branches; next 1.18; 1.18 date 2005.05.17.19.01.36; author rillig; state Exp; branches; next 1.17; 1.17 date 2005.04.30.15.05.06; author jlam; state Exp; branches; next 1.16; 1.16 date 2004.08.23.16.37.09; author jlam; state Exp; branches 1.16.4.1; next 1.15; 1.15 date 2004.08.23.16.36.00; author jlam; state Exp; branches; next 1.14; 1.14 date 2004.08.23.16.35.11; author jlam; state Exp; branches; next 1.13; 1.13 date 2004.08.23.09.01.57; author jlam; state Exp; branches; next 1.12; 1.12 date 2004.06.06.04.22.23; author schmonz; state Exp; branches; next 1.11; 1.11 date 2004.03.07.09.29.25; author grant; state Exp; branches; next 1.10; 1.10 date 2004.03.01.09.57.10; author uebayasi; state Exp; branches; next 1.9; 1.9 date 2003.12.29.02.55.22; author kim; state Exp; branches; next 1.8; 1.8 date 2003.12.28.17.28.26; author kim; state Exp; branches; next 1.7; 1.7 date 2003.12.28.15.57.29; author jmmv; state Exp; branches; next 1.6; 1.6 date 2003.12.27.03.05.53; author grant; state Exp; branches; next 1.5; 1.5 date 2003.12.27.03.02.11; author grant; state Exp; branches; next 1.4; 1.4 date 2003.12.11.00.05.36; author grant; state Exp; branches; next 1.3; 1.3 date 2003.10.07.10.19.09; author jlam; state Exp; branches 1.3.2.1; next 1.2; 1.2 date 2003.09.02.06.59.47; author jlam; state Exp; branches; next 1.1; 1.1 date 2003.08.27.11.24.37; author jlam; state Exp; branches 1.1.2.1; next ; 1.16.4.1 date 2005.05.17.18.29.44; author tv; state Exp; branches; next 1.16.4.2; 1.16.4.2 date 2006.06.07.15.25.39; author tv; state dead; branches; next ; 1.3.2.1 date 2003.12.11.09.55.31; author agc; state Exp; branches; next ; 1.1.2.1 date 2003.08.27.11.24.37; author jlam; state dead; branches; next 1.1.2.2; 1.1.2.2 date 2003.08.27.11.44.32; author jlam; state Exp; branches; next ; desc @@ 1.107 log @mk/subst.mk: clean up documentation @ text @# $NetBSD: subst.mk,v 1.106 2022/11/23 10:53:14 jperkin Exp $ # # The subst framework replaces text in one or more files in the WRKSRC # directory. Packages can define several ``classes'' of replacements. # Each such class defines: # # - in which stage of the build process the replacement happens # - which files are affected by the replacement # - which text or pattern is replaced by which replacement text # # A typical example is: # # SUBST_CLASSES+= prefix # SUBST_STAGE.prefix= pre-configure # SUBST_FILES.prefix= ./configure doc/*.html # SUBST_SED.prefix= -e 's,/usr/local,${PREFIX},g' # # User-settable variables: # # SUBST_SHOW_DIFF # Whether to log each changed file as a unified diff, for all # SUBST classes. Defaults to "no". # # Package-settable variables: # # SUBST_CLASSES # A list of class names. When adding new classes to this list, be # sure to append them (+=) instead of overriding them (=). # The order in which the classes are applied is unspecified. # # SUBST_STAGE. # "stage" at which we do the text replacement. Should be one of # {pre,do,post}-{extract,configure,build,install}. # # SUBST_MESSAGE. # The message to display before doing the substitution. # # SUBST_FILES. # A list of file patterns on which to run the substitution; # the filenames are either absolute or relative to ${WRKSRC}. # # It is an error if any of these patterns has no effect at all, to # catch typos and outdated definitions. To prevent this, see # SUBST_NOOP_OK. below. # # In most cases the filename patterns are given directly. # If that is not flexible enough, use the :sh variable modifier. # See mk/configure/replace-localedir.mk for an example. # # SUBST_SED. # List of sed(1) arguments to run on the specified files. # Multiple commands can be specified using the -e option of sed. # Do not use non-standard sed options (e.g. -E). # # SUBST_VARS. # List of variables that are substituted whenever they appear in # the form @@VARNAME@@. This is basically a shortcut for # # -e 's,@@VARNAME@@,${VARNAME},g' # # that even works when ${VARNAME} contains arbitrary characters. # SUBST_SED and SUBST_VARS can be combined freely. # # SUBST_FILTER_CMD. # Filter used to perform the actual substitution on the specified # files. Defaults to ${SED} ${SUBST_SED.}. # # SUBST_SKIP_TEXT_CHECK. # By default, each file is checked whether it really is a text file # before any substitutions are done to it. Since that test is not # perfect, it can be disabled by setting this variable to "yes". # # SUBST_SHOW_DIFF. # During development of a package, this can be set to "yes" to see # the actual changes as a unified diff. # # SUBST_NOOP_OK. # Whether to allow filename patterns in SUBST_FILES that don't # contain any of the patterns from SUBST_SED. # # Defaults to no, which means that each filename pattern in # SUBST_FILES must contain any of the patterns from SUBST_SED. # # Identity substitutions like s|man|man| do not count as no-ops # since their replacement part usually comes from a variable, such # as PKGMANDIR. # # This setting only detects redundant filename patterns. It does # not detect redundant patterns in SUBST_SED. # # Typical reasons to change this to yes are: # # 1. SUBST_FILES is generated dynamically (e.g., via find) and # may include unaffected files. # # 2. There are multiple SUBST_SED patterns, and some of these # do not count as identity substitution since they contain # ".*" or similar parts. # # See also: # PLIST_SUBST # # Keywords: subst # SUBST_SHOW_DIFF?= no _VARGROUPS+= subst _USER_VARS.subst= SUBST_SHOW_DIFF _PKG_VARS.subst= SUBST_CLASSES .for c in ${SUBST_CLASSES} . for pv in SUBST_STAGE SUBST_MESSAGE SUBST_FILES SUBST_SED SUBST_VARS \ SUBST_FILTER_CMD SUBST_SKIP_TEXT_CHECK SUBST_NOOP_OK _PKG_VARS.subst+= ${pv}.${c} . endfor .endfor _DEF_VARS.subst= ECHO_SUBST_MSG _USE_VARS.subst= WRKDIR WRKSRC _IGN_VARS.subst= _SUBST_IS_TEXT_FILE_CMD _SORTED_VARS.subst= SUBST_CLASSES SUBST_FILES.* SUBST_VARS.* _LISTED_VARS.subst= SUBST_SED.* SUBST_FILTER_CMD.* ECHO_SUBST_MSG?= ${STEP_MSG} # _SUBST_IS_TEXT_FILE_CMD exits successfully if $$file is a text file. _SUBST_IS_TEXT_FILE_CMD= \ [ -z "`LC_ALL=C ${TR} -cd '\\0' < \"$$file\" | ${TR} '\\0' 'x'`" ] .if ${SUBST_CLASSES:U:O} != ${SUBST_CLASSES:U:O:u} PKG_FAIL_REASON+= "[subst.mk] duplicate SUBST class in: ${SUBST_CLASSES:O}" .endif .for class in ${SUBST_CLASSES:O:u} _SUBST_COOKIE.${class}= ${WRKDIR}/.subst_${class}_done . if defined(SUBST_FILTER_CMD.${class}) && (defined(SUBST_SED.${class}) || defined(SUBST_VARS.${class})) PKG_FAIL_REASON+= "[subst.mk:${class}] SUBST_FILTER_CMD and SUBST_SED/SUBST_VARS cannot be combined." . endif SUBST_FILTER_CMD.${class}?= LC_ALL=C ${SED} ${SUBST_SED.${class}} SUBST_MESSAGE.${class}?= Substituting "${class}" in ${SUBST_FILES.${class}} . for v in ${SUBST_VARS.${class}} SUBST_FILTER_CMD.${class}+= -e s,@@${v:C|[.[\\*^]|\\\\&|gW:Q}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:S|${.newline}|\\${.newline}|gW:Q},g . endfor . if ${SUBST_SHOW_DIFF.${class}:U${SUBST_SHOW_DIFF}:tl} == yes _SUBST_KEEP.${class}?= LC_ALL=C ${DIFF} -u "$$file" "$$tmpfile" || ${TRUE} . endif _SUBST_KEEP.${class}?= ${TRUE} SUBST_SKIP_TEXT_CHECK.${class}?= \ no SUBST_NOOP_OK.${class}?= no _SUBST_WARN.${class}= ${${SUBST_NOOP_OK.${class}:tl} == yes:?${INFO_MSG}:${WARNING_MSG}} "[subst.mk:${class}]" . if !empty(SUBST_SKIP_TEXT_CHECK.${class}:M[Yy][Ee][Ss]) _SUBST_IS_TEXT_FILE_CMD.${class}= ${TRUE} . else _SUBST_IS_TEXT_FILE_CMD.${class}= ${_SUBST_IS_TEXT_FILE_CMD} . endif . if defined(SUBST_STAGE.${class}) ${SUBST_STAGE.${class}}: subst-${class} . else # SUBST_STAGE.* does not need to be defined. #PKG_FAIL_REASON+= "SUBST_STAGE missing for ${class}." . endif .PHONY: subst-${class} subst-${class}: ${_SUBST_COOKIE.${class}} ${_SUBST_COOKIE.${class}}: ${RUN} set -u; \ message=${SUBST_MESSAGE.${class}:Q}; \ [ "$$message" ] && ${ECHO_SUBST_MSG} "$$message"; \ \ cd ${WRKSRC}; \ patterns=${SUBST_FILES.${class}:Q}; \ set -f; \ noop_count=''; \ noop_patterns=''; \ noop_sep=''; \ for pattern in $$patterns; do \ set +f; \ found_any=no; \ for file in $$pattern; do \ case $$file in ([!A-Za-z0-9/]*) file="./$$file";; esac; \ tmpfile="$$file.subst.sav"; \ [ -d "$$file" ] && continue; \ [ -f "$$file" ] || { \ ${_SUBST_WARN.${class}} "Ignoring nonexistent file \"$$file\"."; \ continue; \ }; \ ${_SUBST_IS_TEXT_FILE_CMD.${class}} || { \ ${_SUBST_WARN.${class}} "Ignoring non-text file \"$$file\"."; \ continue; \ }; \ ${SUBST_FILTER_CMD.${class}} < "$$file" > "$$tmpfile"; \ ${CMP} -s "$$tmpfile" "$$file" && { \ LC_ALL=C ${AWK} -f ${PKGSRCDIR}/mk/scripts/subst-identity.awk -- ${SUBST_SED.${class}} \ && found_text=$$(LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file") \ && [ -n "$$found_text" ] \ && found_any=yes \ || ${_SUBST_WARN.${class}} "Nothing changed in \"$$file\"."; \ ${RM} -f "$$tmpfile"; \ continue; \ }; \ [ -x "$$file" ] && ${CHMOD} +x "$$tmpfile"; \ found_any=yes; \ ${_SUBST_KEEP.${class}}; \ ${MV} -f "$$tmpfile" "$$file"; \ ${ECHO} "$$file" >> ${.TARGET}.tmp; \ done; \ \ [ "$$found_any,${SUBST_NOOP_OK.${class}:tl}" = no,no ] && { \ noop_count="$$noop_count+"; \ noop_patterns="$$noop_patterns$$noop_sep$$pattern"; \ noop_sep=" "; \ } || ${TRUE}; \ done; \ \ case $$noop_count in \ ('') ;; \ (+) ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$noop_patterns\" has no effect.";; \ (*) ${FAIL_MSG} "[subst.mk:${class}] The filename patterns \"$$noop_patterns\" have no effect.";; \ esac; \ ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp; \ ${MV} ${.TARGET}.tmp ${.TARGET} .endfor @ 1.106 log @mk: Don't define DO_NADA to true. Ironically, DO_NADA was not doing nothing, it was invoking shells simply to run true. Now that we are actually doing nothing, we're saving around 160 shell execs per build! @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.105 2022/07/06 20:59:51 rillig Exp $ d42 3 a44 3 # Starting with 2020Q1, it is an error if any of these patterns # has no effect at all, to catch typos and outdated definitions. # To prevent this, see SUBST_NOOP_OK. below. @ 1.105 log @mk/subst.mk: fix indentation of directives @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.104 2021/05/19 14:44:22 triaxx Exp $ d146 1 a146 1 _SUBST_KEEP.${class}?= LC_ALL=C ${DIFF} -u "$$file" "$$tmpfile" || true d148 1 a148 1 _SUBST_KEEP.${class}?= ${DO_NADA} @ 1.104 log @subst.mk: Fix mk/scrips/subst-identity.awk for FreeBSD At least on FreeBSD 13.0, awk '/^[\t -~]/' does not match alphabetical characters with some utf-8 locales (e.g. neither en_US.UTF-8 nor fr_FR.UTF-8 works but C.UTF-8 does). @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.103 2020/10/06 17:48:02 rillig Exp $ d136 1 a136 1 .if defined(SUBST_FILTER_CMD.${class}) && (defined(SUBST_SED.${class}) || defined(SUBST_VARS.${class})) d138 1 a138 1 .endif @ 1.103 log @mk/subst.mk: remove SUBST_NOOP_OK This means that from now on, there is no global setting to switch off this redundancy check. Individual SUBST classes can still set their own SUBST_NOOP_OK. in order to ignore no-op filename patterns. The current bulk builds do not show any build failures that are caused by this, which means that really almost all packages have been migrated. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.102 2020/06/29 18:04:13 rillig Exp $ d198 1 a198 1 ${AWK} -f ${PKGSRCDIR}/mk/scripts/subst-identity.awk -- ${SUBST_SED.${class}} \ @ 1.102 log @mk/subst.mk: activate the SUBST no-op check again by default It had been switched off to not affect packages in the stable branch 2020Q2. Now starts the last round where it is possible to disable this check. After 2020Q3, all SUBST blocks must either find their patterns or be explicitly marked as potential no-ops. This will help to find outdated SUBST blocks. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.101 2020/06/25 08:45:00 jperkin Exp $ a23 14 # SUBST_NOOP_OK # Whether it is ok to have patterns in SUBST_FILES that don't # contain any of the patterns from SUBST_SED or SUBST_VARS and # thus are not modified at all. # # This setting only detects redundant filename patterns. It does # not detect redundant patterns in SUBST_SED. # # Identity substitutions like s|man|man| do not count as no-ops # since their replacement part usually comes from a variable, such # as PKGMANDIR. # # Defaults to no. Will be removed after 2020Q3. # d81 9 a89 1 # Defaults to no, since May 2020. a106 1 SUBST_NOOP_OK?= no # will be forced to "no" after 2020Q3 d109 1 a109 1 _USER_VARS.subst= SUBST_SHOW_DIFF SUBST_NOOP_OK d151 1 a151 1 SUBST_NOOP_OK.${class}?= ${SUBST_NOOP_OK} @ 1.101 log @mk: Handle pdksh issue with "set -e" in for loop. With our current version of pdksh, a "false && something" construct under "set -e" conditions will continue as it does with other shells, but if the construct is within a for loop then it exits, causing failures in the substitution code. An explicit "|| true" is necessary to avoid this. Approved during the freeze by wiz. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.100 2020/06/16 18:13:54 rillig Exp $ d113 1 a113 1 SUBST_NOOP_OK?= yes # for the stable branch 2020Q2 @ 1.100 log @mk/subst.mk: SUBST_NOOP_OK defaults to yes again There are still some packages that fail the strict SUBST check. These packages should nevertheless be built using the default pkgsrc configuration, at least in the stable 2020Q2 branch. After 2020Q2 has been switched, the strict SUBST checks will be activated again in the default configuration. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.99 2020/06/11 20:13:22 rillig Exp $ d224 1 a224 1 }; \ @ 1.99 log @mk/subst.mk: remove unnecessary SUBST_VARS definition This is a package-settable variable, and if a package leaves it undefined, "bmake show-all-subst" should show exactly this. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.98 2020/06/11 19:38:40 rillig Exp $ d113 1 a113 1 SUBST_NOOP_OK?= no # since May 2020 @ 1.98 log @mk/subst.mk: document the unspecified application order To avoid bmake warnings because of duplicate class names, the :O:u modifier had been added in r1.66 on 2020-03-21. This had the side effect that the subst classes are now applied in alphabetical order instead of declaration order. For this to actually matter, there must be a file that is affected by two different subst classes and in which the substitutions depend on each other or prevent each other. Chances for that are pretty low. The order is intentionally documented as being unspecified, to allow for future modifications, just in case that a bmake variable modifier is invented that filters for duplicates without requiring the duplicates to be adjacent to each other. In that situation, it would be nicer to switch back to declaration order instead of alphabetical. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.97 2020/06/11 19:27:56 rillig Exp $ a147 1 SUBST_VARS.${class}?= # none @ 1.97 log @mk/subst.mk: fix local variable names These variables don't record whether a file is changed but instead whether a pattern was found. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.96 2020/06/11 18:04:41 rillig Exp $ d43 1 @ 1.96 log @mk/subst.mk: always remove temporary file Fixes PR pkg/55364. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.95 2020/06/03 10:56:46 gdt Exp $ d190 1 a190 1 changed=no; \ d203 1 a203 1 ${SUBST_FILTER_CMD.${class}} < "$$file" > "$$tmpfile"; \ d206 3 a208 3 && found=$$(LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file") \ && [ -n "$$found" ] \ && changed=yes \ d214 1 a214 1 changed=yes; \ d220 1 a220 1 [ "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no ] && { \ @ 1.95 log @subst.mk: Move hint about find to package-settable section @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.94 2020/06/02 23:37:25 gdt Exp $ d207 3 a209 5 && [ -n "$$found" ] && { \ changed=yes; \ continue; \ }; \ ${_SUBST_WARN.${class}} "Nothing changed in \"$$file\"."; \ @ 1.94 log @subst.mk: Give hint abotu SUBST_NOOP_OK Note that a typical reason to need this is using find to generate a list of files. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.93 2020/05/16 19:02:32 rillig Exp $ d27 1 a27 2 # thus are not modified at all. (A typical cause of this is # using find to generate a list of files.) d98 2 a99 2 # 1. SUBST_FILES is generated dynamically and may include # unaffected files. @ 1.93 log @mk/subst.mk: change default value for SUBST_NOOP_OK from yes to no This makes the SUBST blocks stricter than before, to detect outdated or unnecessary definitions. Filename patterns that are not affected by any of the SUBST_SED expressions make the build fail. It is still ok if only some of the files from a pattern are affected and some aren't. The latest bulk build shows that most of the build failures are fixed. The packages that fail in that build are mostly due to other failures, like missing C headers, wrong PLIST files, unresolved references at link time. There may be a few packages that still fail because of this, but these are near the leaves of the dependency tree. https://mail-index.netbsd.org/pkgsrc-bulk/2020/05/14/msg018919.html @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.92 2020/05/02 05:52:09 rillig Exp $ d27 2 a28 1 # thus are not modified at all. @ 1.92 log @mk/subst.mk: fix shell parse error for special sed expressions The escaping inside the backticks had been wrong. Because of this, parentheses and semicolons were interpreted as shell syntax. Switching to $(...) command substitution removes the need for quoting some of the characters and makes the whole command simpler to understand. Doing the escaping for the backticks command properly would have involved lots of special cases. The $(...) command substitution was used sparingly in pkgsrc up to now because some older or broken shells do not support it. Since these shells do not end up as the shell that runs the commands from Makefiles, that's not a problem. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.91 2020/05/01 19:53:48 rillig Exp $ d25 10 a34 14 # Whether it is ok to list files in SUBST_FILES that don't contain # any of the patterns from SUBST_SED or SUBST_VARS. Such a # situation often arises when a package is updated to a newer # version, and the build instructions of the package have been # made more portable or flexible. # # This setting only affects the filename patterns in SUBST_FILES. # It does not (yet) affect the regular expressions in SUBST_SED. # # From the viewpoint of sed(1), a pattern like s|man|man| may look # redundant but it really isn't, because the second "man" probably # comes from ${PKGMANDIR}, which may be configured to a different # directory. Patterns like these are therefore allowed, even if # they are no-ops in the current configuration. d36 1 a36 2 # For backwards compatibility this defaults to "yes", but it # should rather be set to "no". d91 2 a92 3 # Whether to fail when a SUBST_FILES pattern has no effect. # In most cases, "yes" is appropriate, to catch typos and outdated # definitions. d94 10 a103 1 # Default: no (up to 2019Q4), yes (starting with 2020Q1) d112 1 a112 1 SUBST_NOOP_OK?= yes # only for backwards compatibility @ 1.91 log @mk/subst.mk: fix typo in diagnostic @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.90 2020/05/01 06:42:32 rillig Exp $ d203 1 a203 1 && found=`LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,:C,[\\`"],\\\\&,g} "$$file"` \ @ 1.90 log @mk/subst.mk: switch command substitution back to backticks To work properly, the $(...) should have been $$(...). In pkgsrc the command substitution is usually done via `backticks`, for compatibility with /bin/sh from Solaris. To fix the shell parse errors, the special characters are properly escaped inside the command substitution. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.89 2020/04/30 23:52:30 joerg Exp $ d193 1 a193 1 ${_SUBST_WARN.${class}} "Ignoring non-existent file \"$$file\"."; \ @ 1.89 log @Simplify @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.88 2020/04/30 23:51:45 joerg Exp $ d203 1 a203 1 && found=$(LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file") \ @ 1.88 log @Use $() as it gives more consistent quoting behavior as seen by devel/ruby-redmine. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.87 2020/04/30 23:51:15 joerg Exp $ d204 1 a204 1 && [ "x$$found" != "x" ] && { \ @ 1.87 log @Terminate case properly @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.86 2020/04/29 22:46:42 rillig Exp $ d203 1 a203 1 && found=`LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file"` \ @ 1.86 log @mk/subst.mk: fix combination of SUBST_FILTER_CMD with SUBST_NOOP_OK=no Since SUBST_FILTER_CMD is a shell command, it may contain arbitrary characters. The condition in mk/subst.mk that tested whether SUBST_FILTER_CMD was the default filter command was evaluated at run time. In such an evaluation, the variables (lhs and rhs) are fully expanded before parsing the condition. This means that these variables must not contain quotes or unquoted condition operators. Exactly this situation came up in one of the regression tests. The quoted "0-9" was copied verbatimly into the condition, including the quotes. The resulting condition was: "tr -d "0-9"" == "LC_ALL=C /usr/bin/sed " This produced a syntax error because of the left-hand side. Adding a :Q modifier would have helped for the left-hand side, but this would have been necessary for the right-hand side as well. Since an empty SUBST_SED is defined not to "contain only identity substitutions", the first condition can simply be removed. The whole condition in the shell program had not worked anyway since it expanded to either "[ true ]" or to "[ false ]", and both of these commands exited successfully. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.85 2020/04/29 18:33:56 rillig Exp $ d229 1 a229 1 (*) ${FAIL_MSG} "[subst.mk:${class}] The filename patterns \"$$noop_patterns\" have no effect."; \ @ 1.85 log @mk/subst.mk: allow identity substitutions in SUBST_NOOP_OK=no mode There are several cases where patterns like s|man|${PKGMANDIR}| appear in SUBST_SED. Up to now, these had been categorized as no-ops and required extra code to make the package build when SUBST_NOOP_OK was set to "no". This was against the original intention of SUBST_NOOP_OK, which was to find outdated substitution patterns that do not occur in SUBST_FILES anymore, most often because the packages have been updated since. The identity substitutions do appear in the files, they just don't change them. Typical cases are for PKGMANDIR, DEVOSSAUDIO, PREFIX, and these variables may well be different in another pkgsrc setup. These patterns are therefore excluded from the SUBST_NOOP_OK check. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.84 2020/04/23 19:32:53 rillig Exp $ d139 4 d202 1 a202 2 [ ${"${SUBST_FILTER_CMD.${class}}" == "LC_ALL=C ${SED} ${SUBST_SED.${class}}":?true:false} ] \ && ${AWK} -f ${PKGSRCDIR}/mk/scripts/subst-identity.awk -- ${SUBST_SED.${class}} \ @ 1.84 log @mk/subst.mk: don't recommend {pre,do,post}-patch These often lead to broken patches, unless the patches are generated very cautiously. Because of this, pkglint already warns about this. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.83 2020/04/23 19:30:29 rillig Exp $ d25 14 a38 2 # Whether it is ok to have filename patterns in SUBST_FILES that # don't have any effect. d109 1 a109 1 SUBST_NOOP_OK?= yes # only for backwards compatiblity d198 7 d215 1 a215 1 \ @ 1.83 log @mk/subst.mk: warn about all noop patterns before erroring out @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.82 2020/04/23 19:16:49 rillig Exp $ d39 1 a39 1 # {pre,do,post}-{extract,patch,configure,build,install}. @ 1.82 log @mk/subst.mk: omit ./ for sanely named files, quote filename patterns @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.81 2020/04/23 19:06:09 rillig Exp $ d159 1 a159 1 ${RUN} \ d166 3 d197 6 a202 3 [ "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no ] \ && ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$pattern\" has no effect."; \ done; \ d204 5 @ 1.81 log @mk/subst.mk: refactor main code The indentation of the inner loop has been fixed. The chmod is only run if the file has actually changed. In the other case, the file would have been removed right after the chmod, which made the chmod unnecessary. For compatibility with ancient operating systems whose /bin/sh still does not understand negated conditions (SunOS), these conditions have been avoided and were written using && and || instead. The inner loop has been flattened a bit, to compensate for the indentation of the outer loop. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.80 2020/04/23 18:06:13 rillig Exp $ d170 1 a170 1 case $$file in /*) ;; *) file="./$$file";; esac; \ d183 1 a183 1 ${_SUBST_WARN.${class}} "Nothing changed in $$file."; \ @ 1.80 log @mk/subst.mk: prevent filename expansion using "set -f" This avoids creating a temporary directory. The "set -f" option is not used anywhere else in pkgsrc, even though it has been available since 1985 in the 8th Edition of Research Unix. Even AIX and IRIX have that option, so it seems a safe bet. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.79 2020/04/18 15:04:34 rillig Exp $ a158 2 ${RUN} message=${SUBST_MESSAGE.${class}:Q}; \ if [ "$$message" ]; then ${ECHO_SUBST_MSG} "$$message"; fi d160 3 d167 16 a182 15 set +f; \ changed=no; \ for file in $$pattern; do \ case $$file in /*) ;; *) file="./$$file";; esac; \ tmpfile="$$file.subst.sav"; \ if [ ! -f "$$file" ]; then \ [ -d "$$file" ] || ${_SUBST_WARN.${class}} "Ignoring non-existent file \"$$file\"."; \ elif ${_SUBST_IS_TEXT_FILE_CMD.${class}}; then \ ${SUBST_FILTER_CMD.${class}} \ < "$$file" \ > "$$tmpfile"; \ if ${TEST} -x "$$file"; then \ ${CHMOD} +x "$$tmpfile"; \ fi; \ if ${CMP} -s "$$tmpfile" "$$file"; then \ d185 12 a196 10 else \ changed=yes; \ ${_SUBST_KEEP.${class}}; \ ${MV} -f "$$tmpfile" "$$file"; \ ${ECHO} "$$file" >> ${.TARGET}.tmp; \ fi; \ else \ ${_SUBST_WARN.${class}} "Ignoring non-text file \"$$file\"."; \ fi; \ done; \ d198 2 a199 5 if ${TEST} "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no; then \ ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$pattern\" has no effect."; \ fi; \ done ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET} @ 1.79 log @mk/subst.mk: document that SUBST_VARS does not support dollar @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.78 2020/04/18 12:59:43 rillig Exp $ d162 1 a162 2 basedir=${WRKSRC:Q}; \ emptydir="$$basedir/.subst-empty"; \ d164 1 a164 1 ${MKDIR} "$$emptydir"; cd "$$emptydir"; \ d166 1 a167 1 cd "$$basedir"; \ d173 1 a173 1 elif ${_SUBST_IS_TEXT_FILE_CMD.${class}}; then \ d197 1 a197 2 done; \ cd ${WRKDIR}; ${RMDIR} "$$emptydir" @ 1.78 log @mk/subst.mk: make error message for filename pattern easier readable @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.77 2020/04/18 12:21:10 rillig Exp $ d131 1 a131 1 SUBST_FILTER_CMD.${class}+= -e s,@@${v:C|[.[\\*^${$}]|\\\\&|gW:Q}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:S|${.newline}|\\${.newline}|gW:Q},g @ 1.77 log @mk/subst.mk: avoid undefined behavior in regular expressions https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html says in section 9.3.2 BRE Ordinary Characters that only very few characters may be preceded with a backslash. As a side effect, this change allows parentheses in the variable names listed in SUBST_VARS (even if that will never happen in practice). The reason that the regression test had not replaced VAR.[] before was simply that this variable had not been listed in SUBST_VARS. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.76 2020/04/18 11:42:34 rillig Exp $ d196 1 a196 1 ${FAIL_MSG} "[subst.mk:${class}] The pattern $$pattern has no effect."; \ @ 1.76 log @mk/subst.mk: fix pkglint warnings and notes @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.75 2020/04/18 11:32:01 rillig Exp $ d131 1 a131 1 SUBST_FILTER_CMD.${class}+= -e s,@@${v:C|[^A-Za-z0-9_]|\\\\&|gW:Q}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:S|${.newline}|\\${.newline}|gW:Q},g @ 1.75 log @mk/subst.mk: rename local variable _class_ to class This makes the code a bit more readable. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.74 2020/04/01 15:10:09 rillig Exp $ d100 1 a100 1 _USR_VARS.subst= SUBST_SHOW_DIFF SUBST_NOOP_OK d116 3 a118 3 # _SUBST_IS_TEXT_FILE_CMD returns 0 if $$file is a text file. _SUBST_IS_TEXT_FILE_CMD?= \ [ -z "`LC_ALL=C ${TR} -cd '\\0' < "$$file" | ${TR} '\\0' 'x'`" ] d137 2 a138 1 SUBST_SKIP_TEXT_CHECK.${class}?= no d142 1 a142 1 .if !empty(SUBST_SKIP_TEXT_CHECK.${class}:M[Yy][Ee][Ss]) d144 1 a144 1 .else d146 1 a146 1 .endif d195 1 a195 1 if test "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no; then \ @ 1.74 log @mk/subst.mk: add user-settable SUBST_NOOP_OK This variable allows to make SUBST stricter than before. This will break several packages that have redundant filename patterns. Most of these are typos or outdated and should be updated or removed. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.73 2020/03/28 20:39:50 rillig Exp $ d124 2 a125 2 .for _class_ in ${SUBST_CLASSES:O:u} _SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done d127 5 a131 5 SUBST_FILTER_CMD.${_class_}?= LC_ALL=C ${SED} ${SUBST_SED.${_class_}} SUBST_VARS.${_class_}?= # none SUBST_MESSAGE.${_class_}?= Substituting "${_class_}" in ${SUBST_FILES.${_class_}} . for v in ${SUBST_VARS.${_class_}} SUBST_FILTER_CMD.${_class_}+= -e s,@@${v:C|[^A-Za-z0-9_]|\\\\&|gW:Q}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:S|${.newline}|\\${.newline}|gW:Q},g d133 2 a134 2 . if ${SUBST_SHOW_DIFF.${_class_}:U${SUBST_SHOW_DIFF}:tl} == yes _SUBST_KEEP.${_class_}?= LC_ALL=C ${DIFF} -u "$$file" "$$tmpfile" || true d136 4 a139 4 _SUBST_KEEP.${_class_}?= ${DO_NADA} SUBST_SKIP_TEXT_CHECK.${_class_}?= no SUBST_NOOP_OK.${_class_}?= ${SUBST_NOOP_OK} _SUBST_WARN.${_class_}= ${${SUBST_NOOP_OK.${_class_}:tl} == yes:?${INFO_MSG}:${WARNING_MSG}} "[subst.mk:${_class_}]" d141 2 a142 2 .if !empty(SUBST_SKIP_TEXT_CHECK.${_class_}:M[Yy][Ee][Ss]) _SUBST_IS_TEXT_FILE_CMD.${_class_}= ${TRUE} d144 1 a144 1 _SUBST_IS_TEXT_FILE_CMD.${_class_}= ${_SUBST_IS_TEXT_FILE_CMD} d147 2 a148 2 . if defined(SUBST_STAGE.${_class_}) ${SUBST_STAGE.${_class_}}: subst-${_class_} d151 1 a151 1 #PKG_FAIL_REASON+= "SUBST_STAGE missing for ${_class_}." d154 2 a155 2 .PHONY: subst-${_class_} subst-${_class_}: ${_SUBST_COOKIE.${_class_}} d157 2 a158 2 ${_SUBST_COOKIE.${_class_}}: ${RUN} message=${SUBST_MESSAGE.${_class_}:Q}; \ d163 1 a163 1 patterns=${SUBST_FILES.${_class_}:Q}; \ d172 3 a174 3 [ -d "$$file" ] || ${_SUBST_WARN.${_class_}} "Ignoring non-existent file \"$$file\"."; \ elif ${_SUBST_IS_TEXT_FILE_CMD.${_class_}}; then \ ${SUBST_FILTER_CMD.${_class_}} \ d181 1 a181 1 ${_SUBST_WARN.${_class_}} "Nothing changed in $$file."; \ d185 1 a185 1 ${_SUBST_KEEP.${_class_}}; \ d190 1 a190 1 ${_SUBST_WARN.${_class_}} "Ignoring non-text file \"$$file\"."; \ d194 2 a195 2 if test "$$changed,${SUBST_NOOP_OK.${_class_}:tl}" = no,no; then \ ${FAIL_MSG} "[subst.mk:${_class_}] The pattern $$pattern has no effect."; \ @ 1.73 log @mk/subst.mk: fix typo in documentation @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.72 2020/03/23 11:27:29 jperkin Exp $ d24 7 d96 3 d100 1 a101 1 SUBST_SHOW_DIFF?= no d138 1 a138 1 SUBST_NOOP_OK.${_class_}?= yes # TODO: change to no after 2020Q1 @ 1.72 log @mk/subst.mk: Unbreak builds with no substitutions. At least some implementations of rmdir(1) do not allow you to remove the current working directory. Fixes bootstrap on SunOS. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.71 2020/03/22 18:43:46 rillig Exp $ d61 1 a61 1 # SUBST_SED and SUBST_VARS can combined freely. @ 1.71 log @mk/subst.mk: only create cookie after everything is finished When fixing the SUBST definitions in a package, it can hapen that the substitution aborts in the middle. In such a case the cookie should not be written and the substitution should be retried. Otherwise the build may continue with half the substitutions done. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.70 2020/03/22 13:19:50 rillig Exp $ d188 1 a188 1 ${RMDIR} "$$emptydir" @ 1.70 log @mk/subst.mk: ignore directories in SUBST_FILES Seen in multimedia/libmp4v2, where a pattern also matches the CVS directory from the distfiles. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.69 2020/03/22 12:15:59 rillig Exp $ d177 1 a177 1 ${ECHO} "$$file" >> ${.TARGET}; \ d189 1 a189 1 ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET:Q} @ 1.69 log @mk/subst.mk: use the same severity for all messages The severity now depends only on the setting of SUBST_NOOP_OK. Right now this means that some former warnings will be reported as info only, but that will change after switching the default of SUBST_NOOP_OK after 2020Q1. Then they will all be reported as warnings, followed by the final error saying that the pattern has no effect. This change makes it easier to detect inconsistencies and outdated definitions, for example by setting the global SUBST_NOOP_OK=no and redefining WARNING_MSG to actuall fail. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.68 2020/03/21 19:26:12 rillig Exp $ d162 1 a162 1 ${_SUBST_WARN.${_class_}} "Ignoring non-existent file \"$$file\"."; \ @ 1.68 log @mk/subst.mk: run diff in the default locale The diff program is only used to produce informative output in the build logs, nevertheless its output might be translated if there are lines that do not end with a newline. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.67 2020/03/21 13:30:35 rillig Exp $ d129 1 d162 1 a162 1 ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \ d171 1 a171 1 ${INFO_MSG} "[subst.mk:${_class_}] Nothing changed in $$file."; \ d180 1 a180 1 ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-text file \"$$file\"."; \ @ 1.67 log @mk/subst.mk: add global SUBST_SHOW_DIFF variable This is useful in bulk builds or when trying to understand what happens under the hood, since the SUBST code leaves no .orig files around. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.66 2020/03/21 12:22:31 rillig Exp $ d124 1 a124 1 _SUBST_KEEP.${_class_}?= ${DIFF} -u "$$file" "$$tmpfile" || true @ 1.66 log @mk/subst.mk: fix bmake warnings in case of duplicate SUBST classes @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.65 2020/03/20 09:00:44 rillig Exp $ d18 6 d91 1 d123 1 a123 1 . if !empty(SUBST_SHOW_DIFF.${_class_}:Uno:M[Yy][Ee][Ss]) @ 1.65 log @mk/subst.mk: evaluate SUBST_MESSAGE only once, and late The default value of SUBST_MESSAGE is based on SUBST_FILES, and that variable may use the :sh modifier to list files from WRKSRC, which may not exist at load time. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.64 2020/03/20 06:17:48 rillig Exp $ d104 1 a104 1 PKG_FAIL_REASON+= "[subst.mk] duplicate SUBST class: ${SUBST_CLASSES:O:u}" d107 1 a107 1 .for _class_ in ${SUBST_CLASSES} @ 1.64 log @mk/subst.mk: fix early evaluation of SUBST_FILES In the case of pkglocaledir, the SUBST_FILES are generated by a shell command. That command assumes that the WRKDIR already exists. Therefore SUBST_FILES must be evaluated as late as possible. See mk/configure/replace-localedir.mk; an example package that fails is devel/gettext-tools. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.63 2020/03/19 16:57:35 rillig Exp $ d39 4 d140 2 a141 3 . if !empty(SUBST_MESSAGE.${_class_}) ${RUN} ${ECHO_SUBST_MSG} ${SUBST_MESSAGE.${_class_}:Q} . endif @ 1.63 log @mk/subst.mk: add SUBST_NOOP_OK to catch typos and outdated definitions In a bulk build with very strict settings (WARNING_MSG fails, as well as no-op substitutions), it became clear that nearly all of the cases where SUBST didn't replace anything were bugs in the package definition. Most of them were just outdated, which is no surprise given that some packages are already over 20 years old. For backwards compatibility, SUBST_NOOP_OK defaults to "yes" right now. After correcting the affected packages, the default will change to "no". @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.62 2019/11/22 18:04:49 minskim Exp $ d139 6 a144 2 .for pattern in ${SUBST_FILES.${_class_}} ${RUN} cd ${WRKSRC:Q}; \ d146 2 a147 1 for file in ${pattern}; do \ d174 4 a177 3 ${FAIL_MSG} "[subst.mk:${_class_}] The pattern "${pattern:Q}" has no effect."; \ fi .endfor @ 1.62 log @mk: Set LC_ALL=C to avoid encoding issue with tr and sed @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.61 2019/09/08 09:06:06 rillig Exp $ d35 4 d51 1 a51 1 # Both SUBST_SED and SUBST_VARS can be used in a single class. d66 7 d83 1 a83 1 SUBST_FILTER_CMD SUBST_SKIP_TEXT_CHECK d99 4 d117 1 d139 1 d141 2 a142 2 files=${SUBST_FILES.${_class_}:Q}; \ for file in $$files; do \ d158 1 d166 6 a171 1 done @ 1.61 log @mk/subst.mk: document variables used in the file, remove SUBST_TARGETS All variables that are used or defined in the file are now listed in the _VARGROUPS section. The "is text file" command variable has been renamed since pkglint thought the former variable name would specify a filename, not a shell command. The "is text file" command has been rewritten to only rely on tr(1) instead of both tr(1) and wc(1). This makes it both simpler and maybe also a little faster, since the file only has to be read once. The SUBST_TARGETS variable has been removed since it is used nowhere else. To get the list of all subst targets (should that ever be necessary), use the expression ${SUBST_CLASSES:S,^,subst-,}. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.60 2019/04/28 12:31:15 rillig Exp $ d86 1 a86 1 [ -z "`${TR} -cd '\\0' < "$$file" | ${TR} '\\0' 'x'`" ] d91 1 a91 1 SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} @ 1.60 log @mk/subst.mk: use simpler words in the documentation, add an example @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.59 2019/03/17 12:01:14 rillig Exp $ d76 3 d84 3 a86 8 # _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file. _SUBST_IS_TEXT_FILE?= \ { nchars=`${WC} -c < "$$file"`; \ notnull=`LC_ALL=C ${TR} -d '\\0' < "$$file" | ${WC} -c`; \ [ "$$nchars" = "$$notnull" ] || ${FALSE} ; \ } _SUBST_BACKUP_SUFFIX= .subst.sav d104 1 a104 1 _SUBST_IS_TEXT_FILE.${_class_}= ${TRUE} d106 1 a106 1 _SUBST_IS_TEXT_FILE.${_class_}= ${_SUBST_IS_TEXT_FILE} a108 2 SUBST_TARGETS+= subst-${_class_} d127 1 a127 1 tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \ d130 1 a130 1 elif ${_SUBST_IS_TEXT_FILE.${_class_}}; then \ @ 1.59 log @mk/subst.mk: substitute embedded newlines, escape dots in variable names @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.58 2018/11/30 18:38:19 rillig Exp $ d3 14 a16 4 # This Makefile fragment implements a general text replacement facility. # Package makefiles define a ``class'', for each of which a particular # substitution description can be defined. For each class of files, a # target subst- is created to perform the text replacement. d42 1 a42 1 # the form @@VARNAME@@. This is basically a short-cut for d46 2 a47 2 # also taking care of (most) quoting issues. You can use both # SUBST_SED and SUBST_VARS in a single class. @ 1.58 log @mk/misc: make configuration for show-all targets more configurable Up to now, there was a central list of variable name patterns that defined whether a variable was printed as a sorted list, as a list or as a single value. Now each variable group decides on its own which of the variables are printed in which way, using the usual glob patterns. This is more flexible since different files sometimes differ in their naming conventions. Two variable groups are added: license (for everything related to LICENSE) and go (for lang/go). @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.57 2018/10/08 20:35:00 rillig Exp $ d87 1 a87 1 SUBST_FILTER_CMD.${_class_}+= -e s,@@${v}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:Q},g @ 1.57 log @Fix whitespace issues reported by pkglint @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.56 2018/01/02 21:18:48 rillig Exp $ d66 2 @ 1.56 log @Allow package developers to easily see and check the SUBST changes. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.55 2016/01/31 17:27:41 rillig Exp $ d85 1 a85 1 SUBST_FILTER_CMD.${_class_} += -e s,@@${v}@@,${${v}:S|\\|\\\\|gW:S|,|\\,|gW:S|&|\\\&|gW:Q},g @ 1.55 log @Fixed subst.mk not to corrupt files Up to now, using subst.mk may have led to file corruption during active package development. This happened when a sed(1) command had a syntax error, in which case the whole sed(1) command was terminated, leaving an empty original file behind. This commit changes that behavior by applying the sed(1) commands to the original file and saving the result in a temporary file. Only after that succeeded is the original file overwritten. During this rewrite, SUBST_POSTCMD has been removed, since it was only used in one place (mk/wrapper), and since it relied on the exact sequence of the internal commands. No package in either main pkgsrc or pkgsrc-wip uses this variable right now. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.54 2013/10/13 21:38:36 dholland Exp $ d48 4 d87 3 @ 1.54 log @Add note to SUBST_SED noting that -E is not a standard sed option. From Leonardo Taccari in followup to PR 48254. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.53 2008/01/26 15:23:21 rillig Exp $ a42 4 # SUBST_POSTCMD. # Command to clean up after sed(1). Defaults to ${RM} -f # $$file${_SUBST_BACKUP_SUFFIX}. For debugging, set it to ${DO_NADA}. # d58 1 a58 1 SUBST_FILTER_CMD SUBST_POSTCMD SUBST_SKIP_TEXT_CHECK d83 1 a83 1 SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile" a115 1 ${MV} -f "$$file" "$$tmpfile" || exit 1; \ d117 4 a120 4 < "$$tmpfile" \ > "$$file"; \ if ${TEST} -x "$$tmpfile"; then \ ${CHMOD} +x "$$file"; \ d124 1 a124 1 ${MV} -f "$$tmpfile" "$$file"; \ d126 2 a127 1 ${SUBST_POSTCMD.${_class_}}; \ @ 1.53 log @See also: PLIST_SUBST @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.52 2008/01/23 01:44:28 rillig Exp $ d26 3 a28 2 # List of sed(1) arguments to run on the specified files. Multiple # commands can be specified using the -e option of sed. @ 1.52 log @Made the wording more into an explanation. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.51 2008/01/18 11:26:11 rillig Exp $ d51 3 @ 1.51 log @If the package doesn't provide a SUBST_MESSAGE, generate a default one. This way, file modifications cannot go unnoticed and at least appear in the build logs. While here, fixed an ambiguity in the description of SUBST_MESSAGE. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.50 2008/01/18 11:16:08 rillig Exp $ d11 2 a12 1 # A list of class names. A new class name must be appended (+=). @ 1.50 log @Don't rely on file(1) to distinguish text files from binary files. This has proven too unreliable in the past. For example, some Makefile.in files were classified as "Quake I or II world or extension", just because they happen to start with the letters "PACK". This method was also subject to subtle differences in the locale. The new method counts the number of NUL bytes in the file. It does not depend on the locale settings. The -c option of wc(1) counts bytes, not characters, and tr(1), which may interpret multibyte sequences, is protected by LC_ALL. It should also work with the historical implementations of tr(1) that could not handle NUL bytes and discarded them, since this is exactly the intention. See also: * http://mail-index.netbsd.org/tech-pkg/2006/07/05/0000.html * PR 37793 @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.49 2008/01/18 10:41:05 rillig Exp $ d18 1 a18 1 # The message to display when the substitution is done. d78 1 d104 1 a104 1 . if defined(SUBST_MESSAGE.${_class_}) @ 1.49 log @Replaced _PKG_SILENT and _PKG_DEBUG with RUN. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.48 2007/11/19 23:38:03 rillig Exp $ d66 4 a69 4 { ${TEST} -f "$$file" \ && ${FILE_CMD} "$$file" \ | ${EGREP} "(executable .* script|shell script|text|Assembler source|libtool|Quake I or II world or extension|XML)"; \ } >/dev/null 2>&1 @ 1.48 log @Explicitly mentioned that both SUBST_SED and SUBST_VARS may be used in a class. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.47 2007/11/01 13:12:48 rillig Exp $ d104 1 a104 2 ${_PKG_SILENT}${_PKG_DEBUG} \ ${ECHO_SUBST_MSG} ${SUBST_MESSAGE.${_class_}:Q} d106 1 a106 2 ${_PKG_SILENT}${_PKG_DEBUG} set -e; \ cd ${WRKSRC:Q}; \ d132 1 a132 2 ${_PKG_SILENT}${_PKG_DEBUG} set -e; \ ${TOUCH} ${TOUCH_FLAGS} ${.TARGET:Q} @ 1.47 log @Before running _SUBST_IS_TEXT_FILE on a file, make sure that the file exists. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.46 2007/04/05 18:33:09 wiz Exp $ d34 2 a35 1 # also taking care of (most) quoting issues. @ 1.46 log @Recognize XML files as text. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.45 2007/03/15 22:54:24 rillig Exp $ d112 3 a114 1 if ${_SUBST_IS_TEXT_FILE.${_class_}}; then \ d129 1 a129 1 elif ${TEST} -f "$$file"; then \ a130 2 else \ ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \ @ 1.45 log @For all those who are interested in the inner workings of pkgsrc, there is a new target "show-all" that fits to the existing "debug", "show-tools", "show-vars" targets. It prints a list of the variables that make up the public interface to pkgsrc. Running this target is especially useful if you want to do some things, you know that they must have been implemented but you don't know what it is called. It also shows the "class" of a variable (user-defined, package-defined, system-defined). @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.44 2007/03/07 21:27:59 rillig Exp $ d67 1 a67 1 | ${EGREP} "(executable .* script|shell script|text|Assembler source|libtool|Quake I or II world or extension)"; \ @ 1.44 log @Fixed the quoting for SUBST_VARS.*. Now every character gets replaced properly. The regression test passes. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.43 2007/02/05 08:39:23 rillig Exp $ d52 9 @ 1.43 log @Some Makefile.in files start with the letters PACKAGE. NetBSD's file(1) considers files starting with the letters PACK to be related to Quake. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.42 2007/01/23 06:05:39 rillig Exp $ d66 1 d68 3 a70 1 SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} ${SUBST_VARS.${_class_}:@@v@@-e 's,\@@${v}\@@,'${${v}:Q}',g' @@} @ 1.42 log @Since there are many cases where the string @@FOO@@ is replaced with the pkgsrc variable ${FOO}, there is now a shorter variant for it. Instead of defining SUBST_SED.*, just say SUBST_VARS.* = FOO. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.41 2007/01/14 17:05:02 rillig Exp $ d58 1 a58 1 | ${EGREP} "(executable .* script|shell script|text|Assembler source|libtool)"; \ @ 1.41 log @The new variable SUBST_SKIP_TEXT_CHECK.* can be set to "yes" to do the substitutions in all files, whether or not file(1) says they are text. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.40 2007/01/11 12:12:12 rillig Exp $ d28 8 d66 2 a67 1 SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} @ 1.40 log @When a SUBST change leaves a file as-is, print an informational message. For all messages, the current SUBST_CLASS is printed, too. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.39 2007/01/03 23:35:13 rillig Exp $ d36 5 d60 7 d91 1 a91 1 if ${_SUBST_IS_TEXT_FILE}; then \ @ 1.39 log @+ keyword "subst" @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.38 2006/12/10 02:25:13 reed Exp $ d88 1 d95 1 a95 1 ${WARNING_MSG} "[subst.mk] Ignoring non-text file \"$$file\"." 1>&2; \ d97 1 a97 1 ${WARNING_MSG} "[subst.mk] Ignoring non-existent file \"$$file\"." 1>&2; \ @ 1.38 log @Also "Assembler source" is a text file for _SUBST_IS_TEXT_FILE. (Really the file is a wdm config file. Noticed when building wdm.) @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.37 2006/11/23 16:27:53 tron Exp $ d35 3 @ 1.37 log @file(1) under NetBSD-sparc64 4.99.4 identifies the file "gdk-pixbuf/Makefile.in" from the "gtk2" package as "libtool library file". Change the textfile check to accept any file which file(1) identifies as "libtool" to fix the build of the "gtk2" package (and probably other packages). @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.36 2006/11/09 02:06:29 rillig Exp $ d42 1 a42 1 | ${EGREP} "(executable .* script|shell script|text|libtool)"; \ @ 1.36 log @Clarify _who_ is supposed to set the SUBST_* variables. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.35 2006/07/02 09:35:05 rillig Exp $ d42 1 a42 1 | ${EGREP} "(executable .* script|shell script|text)"; \ @ 1.35 log @Fixed the documentation for SUBST_SED.*, which is not _one_ sed expression, but a list of sed expressions. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.34 2006/06/22 20:45:48 rillig Exp $ d8 1 a8 1 # The following variables are used: @ 1.34 log @SUBST_STAGE.* is currently not defined by all SUBST blocks, so disable PKG_FAIL_REASON in that case. It didn't have an effect anyway for normal builds, since subst.mk is included after checking PKG_FAIL_REASON. Discussed with jlam. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.33 2006/06/17 22:42:00 rillig Exp $ d25 2 a26 1 # sed(1) substitution expression to run on the specified files. @ 1.33 log @Simplified the code by reducing the number of different targets that are evaluated. Now the SUBST_MESSAGE is only printed once when the substitution is actually done. Before this change it had been printed also when the subst- target had been invoked a second time, but the substitution didn't take place again, which had confused me. Also, converted the code to use ${WARNING_MSG} and ${STEP_MSG}. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.32 2006/01/08 01:07:35 rillig Exp $ d57 2 a58 1 PKG_FAIL_REASON+= "SUBST_STAGE missing for ${_class_}." @ 1.32 log @Reverted the change from 1.29 to 1.30, as it had led to build failures in the "unwrap" class. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.31 2006/01/07 23:27:41 rillig Exp $ d35 1 a35 1 ECHO_SUBST_MSG?= ${ECHO} a52 5 _SUBST_TARGETS.${_class_}= subst-${_class_}-message _SUBST_TARGETS.${_class_}+= ${_SUBST_COOKIE.${_class_}} _SUBST_TARGETS.${_class_}+= subst-${_class_}-cookie .ORDER: ${_SUBST_TARGETS.${_class_}} d56 2 d61 1 a61 1 subst-${_class_}: ${_SUBST_TARGETS.${_class_}} d63 1 a63 2 .PHONY: subst-${_class_}-message subst-${_class_}-message: d66 1 a66 1 ${ECHO_SUBST_MSG} "=> "${SUBST_MESSAGE.${_class_}:Q} a67 7 .PHONY: subst-${_class_}-cookie subst-${_class_}-cookie: ${_PKG_SILENT}${_PKG_DEBUG} \ ${TOUCH} ${TOUCH_FLAGS} ${_SUBST_COOKIE.${_class_}:Q} ${_SUBST_COOKIE.${_class_}}: d89 1 a89 1 ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \ d91 1 a91 1 ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-existent file \"$$file\"." 1>&2; \ d94 2 @ 1.31 log @Added two missing :Q operators. One of them affects how the SUBST_MESSAGE is printed. The ones that have been defined with "quotes" in their Makefiles are printed with quotes (of course). This is the consequence of the design pattern "quote-exactly-where-necessary", which in fact should be have been applied to pkgsrc as a whole, but still isn't. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.30 2006/01/07 18:43:05 rillig Exp $ d37 7 d85 1 a85 1 if ${TEST} -f "$$file"; then \ d99 2 @ 1.30 log @Removed the use of ${FILE_CMD} from the substitution framework. The detection whether a given file was a text file or some other file had been unreliable. In the recent bulk builds, all of the warnings that had appeared because of that unreliable detection had been false positives. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.29 2006/01/05 23:16:01 joerg Exp $ d63 1 a63 1 ${ECHO_SUBST_MSG} "=> "${SUBST_MESSAGE.${_class_}} d69 1 a69 1 ${TOUCH} ${TOUCH_FLAGS} ${_SUBST_COOKIE.${_class_}} @ 1.29 log @Adjust comment about SUBST_FILES to match reality: absolute file names work as well. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.28 2006/01/01 22:52:16 rillig Exp $ a36 7 # _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file. _SUBST_IS_TEXT_FILE?= \ { ${TEST} -f "$$file" \ && ${FILE_CMD} "$$file" \ | ${EGREP} "(executable .* script|shell script|text)"; \ } >/dev/null 2>&1 d78 1 a78 1 if ${_SUBST_IS_TEXT_FILE}; then \ a91 2 elif ${TEST} -f "$$file"; then \ ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \ @ 1.28 log @Fixed some cases where the exitcode of child processes has been ignored. This will cause package builds to fail instead of hiding bugs. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.27 2006/01/01 22:30:35 rillig Exp $ d22 1 a22 1 # the filenames are relative to ${WRKSRC}. @ 1.27 log @Fixed trivial pkglint warnings: - Removed leading white-space in dependency lines. - s/existant/existent/. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.26 2005/12/06 17:17:30 rillig Exp $ d79 1 a79 1 ${_PKG_SILENT}${_PKG_DEBUG} \ d87 2 a88 2 ${CAT} "$$tmpfile" \ | ${SUBST_FILTER_CMD.${_class_}} \ @ 1.26 log @Allow absolute filenames for SUBST_FILES. Needed for converters/convmv and maybe some others. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.25 2005/11/24 20:02:40 rillig Exp $ d67 1 a67 1 subst-${_class_}-message: d74 1 a74 1 subst-${_class_}-cookie: d102 1 a102 1 ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-existant file \"$$file\"." 1>&2; \ @ 1.25 log @Added another diagnostic message to distinguish the cases for non-text file and non-existant file. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.24 2005/11/17 23:17:02 rillig Exp $ d83 1 a83 1 file="./$$file"; \ @ 1.24 log @A warning is printed for every non-text file. This helps in detecting broken file(1) databases. It also gives an indication of whether this test is necessary at all. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.23 2005/08/21 22:00:07 rillig Exp $ d99 2 d102 1 a102 1 ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \ @ 1.23 log @Changed the comment for SUBST_STAGE to be more complete. Started the other sentences with an uppercase letter. No code changes. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.22 2005/06/09 19:49:48 rillig Exp $ d99 2 @ 1.22 log @Fixed a typo. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.21 2005/05/20 21:36:05 jlam Exp $ d14 2 a15 2 # "stage" at which we do the text replacement, e.g. pre-configure, # post-build, etc. d18 1 a18 1 # message to display, noting what is being substituted d21 2 a22 2 # files on which to run the substitution; these are relative to # ${WRKSRC} d25 1 a25 1 # sed(1) substitution expression to run on the specified files d28 1 a28 1 # filter used to perform the actual substitution on the specified d32 1 a32 1 # command to clean up after sed(1). Defaults to ${RM} -f @ 1.21 log @Change instances where we stored `shell command` in a make variable into variables that use the :sh modifier. This still causes expansion to only happen when referenced, and has the advantage of being :Q-safe. Bring back the changes from revision 1.19 of mk/subst.mk now that the problem noted above has been fixed. This passes the buildlink-unwrap regression test. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.19 2005/05/18 03:33:51 rillig Exp $ d4 1 a4 1 # Package makefiles define a ``class'', for each of which a paricular @ 1.20 log @Revert part of revision 1.18. The new quoting was breaking some assumptions being made by the USE_PKGLOCALEDIR code and the wrapper framework since it added backtick expressions to the SUBST_FILES.* variables, which were being mangled by the :Q modifier. This is evident when running "make regress" in regress/buildlink-unwrap. Mea culpa. @ text @d50 1 a50 1 SUBST_POSTCMD.${_class_}?= ${RM} -f $$file${_SUBST_BACKUP_SUFFIX} d80 12 a91 19 cd ${WRKSRC}; \ files="${SUBST_FILES.${_class_}}"; \ case "$$files" in \ "") ;; \ *) for file in $${files}; do \ if ${_SUBST_IS_TEXT_FILE}; then \ ${MV} -f $$file $$file${_SUBST_BACKUP_SUFFIX} || exit 1; \ ${CAT} $$file${_SUBST_BACKUP_SUFFIX} \ | ${SUBST_FILTER_CMD.${_class_}} \ > $$file; \ if [ -x $$file${_SUBST_BACKUP_SUFFIX} ]; then \ ${CHMOD} +x $$file; \ fi; \ if ${CMP} -s $$file${_SUBST_BACKUP_SUFFIX} $$file; then \ ${MV} -f $$file${_SUBST_BACKUP_SUFFIX} $$file; \ else \ ${SUBST_POSTCMD.${_class_}}; \ ${ECHO} $$file >> ${.TARGET}; \ fi; \ d93 8 a100 2 done ;; \ esac @ 1.19 log @Removed the quoting for SUBST_MESSAGE.. Most packages unnecessarily define that inside double quotes. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.18 2005/05/17 19:01:36 rillig Exp $ d50 1 a50 1 SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile" d80 19 a98 12 cd ${WRKSRC:Q}; \ files=${SUBST_FILES.${_class_}:Q}; \ for file in $$files; do \ file="./$$file"; \ tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \ if ${_SUBST_IS_TEXT_FILE}; then \ ${MV} -f "$$file" "$$tmpfile" || exit 1; \ ${CAT} "$$tmpfile" \ | ${SUBST_FILTER_CMD.${_class_}} \ > "$$file"; \ if ${TEST} -x "$$tmpfile"; then \ ${CHMOD} +x "$$file"; \ d100 2 a101 8 if ${CMP} -s "$$tmpfile" "$$file"; then \ ${MV} -f "$$tmpfile" "$$file"; \ else \ ${SUBST_POSTCMD.${_class_}}; \ ${ECHO} "$$file" >> ${.TARGET}; \ fi; \ fi; \ done @ 1.18 log @Fixed shell quoting. Reviewed by jlam. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.17 2005/04/30 15:05:06 jlam Exp $ d70 1 a70 1 ${ECHO_SUBST_MSG} "=> "${SUBST_MESSAGE.${_class_}:Q} @ 1.17 log @Avoid checking for !empty(...) so that we that defer variable references. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.16 2004/08/23 16:37:09 jlam Exp $ d39 4 a42 1 ${FILE_CMD} $${file} | ${EGREP} "(executable .* script|shell script|text)" >/dev/null 2>&1 d50 1 a50 1 SUBST_POSTCMD.${_class_}?= ${RM} -f $$file${_SUBST_BACKUP_SUFFIX} d70 1 a70 1 ${ECHO_SUBST_MSG} "=> ${SUBST_MESSAGE.${_class_}}" d80 12 a91 19 cd ${WRKSRC}; \ files="${SUBST_FILES.${_class_}}"; \ case "$$files" in \ "") ;; \ *) for file in $${files}; do \ if ${_SUBST_IS_TEXT_FILE}; then \ ${MV} -f $$file $$file${_SUBST_BACKUP_SUFFIX} || exit 1; \ ${CAT} $$file${_SUBST_BACKUP_SUFFIX} \ | ${SUBST_FILTER_CMD.${_class_}} \ > $$file; \ if [ -x $$file${_SUBST_BACKUP_SUFFIX} ]; then \ ${CHMOD} +x $$file; \ fi; \ if ${CMP} -s $$file${_SUBST_BACKUP_SUFFIX} $$file; then \ ${MV} -f $$file${_SUBST_BACKUP_SUFFIX} $$file; \ else \ ${SUBST_POSTCMD.${_class_}}; \ ${ECHO} $$file >> ${.TARGET}; \ fi; \ d93 8 a100 2 done ;; \ esac @ 1.16 log @SUBST_POSTCMD must be globally defined or else it breaks. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.15 2004/08/23 16:36:00 jlam Exp $ a45 1 . if defined(SUBST_SED.${_class_}) && !empty(SUBST_SED.${_class_}) a46 3 . else SUBST_FILTER_CMD.${_class_}?= # empty . endif a75 1 . if !empty(SUBST_FILTER_CMD.${_class_}) a98 1 . endif @ 1.16.4.1 log @sync [all but bsd.pkg.mk] with HEAD @ text @d1 1 a1 1 # $NetBSD$ d46 1 d48 3 d80 1 d104 1 @ 1.16.4.2 log @EOL the tv-derecurse branch; it has become too outdated. The last live revision can be fetched at the tv-derecurse-eol tag. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.16.4.1 2005/05/17 18:29:44 tv Exp $ @ 1.15 log @Actually, it's okay if SUBST_FILTER_CMD is empty... the ${SUBST_COOKIE} target takes care of this case already. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.14 2004/08/23 16:35:11 jlam Exp $ a47 1 SUBST_POSTCMD.${_class_}?= ${RM} -f $$file${_SUBST_BACKUP_SUFFIX} d51 1 @ 1.14 log @Use _SUBST_BACKUP_SUFFIX instead of hardcoding ".subst.sav" everywhere. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.13 2004/08/23 09:01:57 jlam Exp $ d50 1 a50 1 SUBST_FILTER_CMD.${_class_}?= ${CAT} @ 1.13 log @SUBST_FILTER_CMD can't be empty. It must be a real filter cmd, so default it to ${CAT} as a fall-through. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.12 2004/06/06 04:22:23 schmonz Exp $ d33 1 a33 1 # $$file.subst.sav. For debugging, set it to ${DO_NADA}. d41 2 d48 1 a48 1 SUBST_POSTCMD.${_class_}?= ${RM} -f $$file.subst.sav d88 2 a89 2 ${MV} -f $$file $$file.subst.sav || exit 1; \ ${CAT} $$file.subst.sav \ d92 1 a92 1 if [ -x $$file.subst.sav ]; then \ d95 2 a96 2 if ${CMP} -s $$file.subst.sav $$file; then \ ${MV} -f $$file.subst.sav $$file; \ @ 1.12 log @Usually there's no need to keep the original version of a file "foo" as "foo.subst.sav". Implement SUBST_POSTCMD, which by default cleans up these leftovers. If you need to keep them around, e.g. while debugging, set it to ${DO_NADA}. Remove superfluous whitespace in a comment. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.11 2004/03/07 09:29:25 grant Exp $ d48 1 a48 1 SUBST_FILTER_CMD.${_class_}?= # empty @ 1.11 log @Solaris' file(1) reports "executable [path] script" on scripts which arent't shell scripts, so allow them to be subst'd. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.10 2004/03/01 09:57:10 uebayasi Exp $ d19 1 a19 1 # d30 4 d46 1 d96 1 @ 1.10 log @* Document SUBST_CLASSES. * Indent conditionals. Reviewed By: wiz @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.9 2003/12/29 02:55:22 kim Exp $ d35 1 a35 1 ${FILE_CMD} $${file} | ${EGREP} "(shell script|text)" >/dev/null 2>&1 @ 1.9 log @Reinstate the fix in revision 1.6 @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.8 2003/12/28 17:28:26 kim Exp $ d3 4 a6 3 # This Makefile fragment implements a general text replacement facility # for different classes of files in ${WRKSRC}. For each class of files, # a target subst- is created to perform the text replacement. d10 3 d40 1 a40 1 .if defined(SUBST_SED.${_class_}) && !empty(SUBST_SED.${_class_}) d42 1 a42 1 .else d44 1 a44 1 .endif d62 1 a62 1 .if defined(SUBST_MESSAGE.${_class_}) d65 1 a65 1 .endif @ 1.8 log @Revert revision 1.5 as binaries and directories are now being substed unintentionally. Also revert revision 1.6 as part of the overall change, as I suspect the change might be unnecessary. While I'm not 100% sure, this does just revert to the previous behaviour. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.7 2003/12/28 15:57:29 jmmv Exp $ d77 1 a77 1 ${MV} -f $$file $$file.subst.sav; \ @ 1.7 log @The generated target is subst-, not -subst. Fix comment accordingly. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.6 2003/12/27 03:05:53 grant Exp $ d29 4 d76 13 a88 11 ${MV} -f $$file $$file.subst.sav || exit 1; \ ${CAT} $$file.subst.sav \ | ${SUBST_FILTER_CMD.${_class_}} \ > $$file; \ if [ -x $$file.subst.sav ]; then \ ${CHMOD} +x $$file; \ fi; \ if ${CMP} -s $$file.subst.sav $$file; then \ ${MV} -f $$file.subst.sav $$file; \ else \ ${ECHO} $$file >> ${.TARGET}; \ @ 1.6 log @bomb to prevent silent failure if we're unable to rename a file before subst'ing it. previously, only a warning would be printed and the .subst_done cookie(s) would be created, indicating that the subst target was successful when it really was not. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.5 2003/12/27 03:02:11 grant Exp $ d5 1 a5 1 # a target -subst is created to perform the text replacement. @ 1.5 log @remove somewhat bogus test for text files, which was dependent on the output of file(1) which reports too many false negatives (not detecting a file as a text file when it really is). package developers are aware of which files the subst operation applies to, since they need to specify the filenames, so this test is not really required. it's also not inconceivable that one would want to subst over a non-text file, which is now possible. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.4 2003/12/11 00:05:36 grant Exp $ d72 1 a72 1 ${MV} -f $$file $$file.subst.sav; \ @ 1.4 log @only print SUBST_MESSAGE if it's defined. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.3 2003/10/07 10:19:09 jlam Exp $ a28 4 # _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file. _SUBST_IS_TEXT_FILE?= \ ${FILE_CMD} $${file} | ${EGREP} "(shell script|text)" >/dev/null 2>&1 d72 11 a82 13 if ${_SUBST_IS_TEXT_FILE}; then \ ${MV} -f $$file $$file.subst.sav; \ ${CAT} $$file.subst.sav \ | ${SUBST_FILTER_CMD.${_class_}} \ > $$file; \ if [ -x $$file.subst.sav ]; then \ ${CHMOD} +x $$file; \ fi; \ if ${CMP} -s $$file.subst.sav $$file; then \ ${MV} -f $$file.subst.sav $$file; \ else \ ${ECHO} $$file >> ${.TARGET}; \ fi; \ @ 1.3 log @Allow a new variable SUBST_FILTER_CMD. that is a command filter or pipeline that takes stdin, performs the substitions and writes the result to stdout. It defaults to ${SED} ${SUBST_SED.}. Use this variable to replace the sed command with something else, like an awk process. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.2 2003/09/02 06:59:47 jlam Exp $ d58 1 d61 1 @ 1.3.2.1 log @Pullup fix to pkgsrc-2003Q4 branch, requested by Grant Beattie. Module Name: pkgsrc Committed By: grant Date: Thu Dec 11 00:05:36 UTC 2003 Modified Files: pkgsrc/mk: subst.mk Log Message: only print SUBST_MESSAGE if it's defined. @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.4 2003/12/11 00:05:36 grant Exp $ a57 1 .if defined(SUBST_MESSAGE.${_class_}) a59 1 .endif @ 1.2 log @Merge pkgviews-mk branch into the HEAD by running: cd pkgsrc/mk cvs update -Pd -A cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk @ text @d1 1 a1 1 # $NetBSD: subst.mk,v 1.1.2.1 2003/08/27 11:44:32 jlam Exp $ d22 4 d36 6 d49 1 a49 1 .if defined(SUBST_STAGE.${_class_}) d51 1 a51 1 .endif d67 1 a67 1 . if !empty(SUBST_SED.${_class_}) d76 3 a78 2 ${SED} ${SUBST_SED.${_class_}} \ $$file.subst.sav > $$file; \ @ 1.1 log @subst.mk is a Makefile fragment that implements a general text replacement facility for different classes of files in ${WRKSRC}. For each class of files, a target -subst is created to perform the text replacement. The following variables are used: SUBST_STAGE. "stage" at which we do the text replacement, e.g. pre-configure, post-build, etc. SUBST_MESSAGE. message to display, noting what is being substituted SUBST_FILES. files on which to run the substitution; these are relative to ${WRKSRC} SUBST_SED. sed(1) substitution expression to run on the specified files This basically extracts a useful piece of code from bsd.buildlink2.mk and puts it in a place that allows it to be more widely used, and so that the functionality doesn't depend on USE_BUILDLINK2 being defined. @ text @d1 1 a1 1 # $NetBSD$ @ 1.1.2.1 log @file subst.mk was added on branch pkgviews-mk on 2003-08-27 11:24:37 +0000 @ text @d1 80 @ 1.1.2.2 log @Sync to HEAD for subst.mk @ text @a0 80 # $NetBSD: subst.mk,v 1.1.2.1 2003/08/27 11:44:32 jlam Exp $ # # This Makefile fragment implements a general text replacement facility # for different classes of files in ${WRKSRC}. For each class of files, # a target -subst is created to perform the text replacement. # # The following variables are used: # # SUBST_STAGE. # "stage" at which we do the text replacement, e.g. pre-configure, # post-build, etc. # # SUBST_MESSAGE. # message to display, noting what is being substituted # # SUBST_FILES. # files on which to run the substitution; these are relative to # ${WRKSRC} # # SUBST_SED. # sed(1) substitution expression to run on the specified files ECHO_SUBST_MSG?= ${ECHO} # _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file. _SUBST_IS_TEXT_FILE?= \ ${FILE_CMD} $${file} | ${EGREP} "(shell script|text)" >/dev/null 2>&1 .for _class_ in ${SUBST_CLASSES} _SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done SUBST_TARGETS+= subst-${_class_} _SUBST_TARGETS.${_class_}= subst-${_class_}-message _SUBST_TARGETS.${_class_}+= ${_SUBST_COOKIE.${_class_}} _SUBST_TARGETS.${_class_}+= subst-${_class_}-cookie .ORDER: ${_SUBST_TARGETS.${_class_}} .if defined(SUBST_STAGE.${_class_}) ${SUBST_STAGE.${_class_}}: subst-${_class_} .endif .PHONY: subst-${_class_} subst-${_class_}: ${_SUBST_TARGETS.${_class_}} .PHONY: subst-${_class_}-message subst-${_class_}-message: ${_PKG_SILENT}${_PKG_DEBUG} \ ${ECHO_SUBST_MSG} "=> ${SUBST_MESSAGE.${_class_}}" .PHONY: subst-${_class_}-cookie subst-${_class_}-cookie: ${_PKG_SILENT}${_PKG_DEBUG} \ ${TOUCH} ${TOUCH_FLAGS} ${_SUBST_COOKIE.${_class_}} ${_SUBST_COOKIE.${_class_}}: . if !empty(SUBST_SED.${_class_}) ${_PKG_SILENT}${_PKG_DEBUG} \ cd ${WRKSRC}; \ files="${SUBST_FILES.${_class_}}"; \ case "$$files" in \ "") ;; \ *) for file in $${files}; do \ if ${_SUBST_IS_TEXT_FILE}; then \ ${MV} -f $$file $$file.subst.sav; \ ${SED} ${SUBST_SED.${_class_}} \ $$file.subst.sav > $$file; \ if [ -x $$file.subst.sav ]; then \ ${CHMOD} +x $$file; \ fi; \ if ${CMP} -s $$file.subst.sav $$file; then \ ${MV} -f $$file.subst.sav $$file; \ else \ ${ECHO} $$file >> ${.TARGET}; \ fi; \ fi; \ done ;; \ esac . endif .endfor @