<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I have been playing around with <b style="font-size:14.67px">CFLAGS += -<span data-markjs="true" class="markqmejkalb2" data-ogac="" data-ogab="" data-ogsc="" data-ogsb="" style="margin:0px">Xarch_ppc</span><span> </span>-faltivec
</b><span style="font-size:14.67px">in my Makefile, as suggested by Josh.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-size:14.67px"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-size:14.67px">I noticed that if I include <b>CFLAGS += -<span data-markjs="true" class="markqmejkalb2" data-ogac="" data-ogab="" data-ogsc="" data-ogsb="" style="margin:0px">Xarch_ppc</span><span> </span>-faltivec</b> in my Makefile, the output
 from the clang compiler gets garbled but the <b>M2VDownsizer</b> binary appears to build fine.  </span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-size:14.67px">E,g,</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-size:14.67px">
<blockquote style="margin-top:0;margin-bottom:0">
<div>/opt/local/var/macports/build/_Users_grinch_Macports_ports_multimedia_M2VDownsizer/M2VDownsizer/work/compwrap/cc/usr/bin/clang -Os -arch x86_64 -Wall -g -Xarch_ppc -faltivec -Xarch_ppc64 -faltivec -I./ -Iutils -Iutils/altivec -Impeg2dec -Impeg2enc -I/System/Library/Frameworks/CoreServices.framework/Headers
  -c utils/mpegconsts.c -o obj/utils/mpegconsts.o</div>
<div><br>
</div>
<div><b>clang: clang: clang: clang: warning: warning: warning: warning: argument unusedargument unusargument dured dur unused dinig ng compilation:uring '- coacompilXarchatmpilio_ppatiornn: gu:c  -m''--faXXarletntciav rhch_ec_ppu'n</b></div>
<div><b>usppc clang: warning: ar-faltedc guiv d-fmeecuralnt'</b></div>
<div><b>ing compilatclang: warning: ioti uarn: '-Xarch_ppc -faltivec'</b></div>
<div><b>clang: warning: argument unused during compilation: '-Xarch_ppc6nguvs4 uemece'</b></div>
<div><b>d-faltivclang: nt decu'</b></div>
<div><b> unriwarning: argument unused during compilation: '-Xarch_ppc64 -faltivec'</b></div>
<div><b>ng compilation: '-Xarch_ppc64 -faltivec'</b></div>
<div><b>used during compilation: '-Xarch_ppc64 -faltivec'</b><br>
</div>
</blockquote>
<div><br>
</div>
<div>I can avoid this garbled output if I turn off parallel builds by including the following in the Portfile:</div>
<div><br>
</div>
<div><b>use_parallel_build  <span>    </span><span>      </span>no</b><br>
</div>
<div><b><br>
</b></div>
<div>What is recommended in these circumstances considering that <span style="background-color:rgb(255, 255, 255);display:inline !important">
the garbled output does not appear to affect building the final binary</span>?  Should I turn off parallel builds in the Portfile?</div>
<div><br>
</div>
<div>Rob</div>
</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Robert Kennedy <amtor@hotmail.com><br>
<b>Sent:</b> August 1, 2022 10:54 AM<br>
<b>To:</b> Joshua Root <jmr@macports.org><br>
<b>Cc:</b> MacPorts Development <macports-dev@lists.macports.org><br>
<b>Subject:</b> Re: Help with New Port - M2VDownsizer</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Joshua,</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I can confirm that your elegant solution using <span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">
<b>CFLAGS += -Xarch_ppc -faltivec</b> does work.  The compile succeeds.  But clang does throw this warning message:</span></div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<blockquote style="margin-top:0; margin-bottom:0">
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<b>clang: warning: argument unused during compilation: '-Xarch_ppc -faltivec'</b><br>
</div>
</blockquote>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
P.S.  To cover the <b>ppc64</b> arch, I also added the following to the Makefile:</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<blockquote style="margin-top:0; margin-bottom:0">
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<b style="font-size:14.6667px">CFLAGS += -Xarch_ppc64 -faltivec</b><br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<b style="font-size:14.6667px"><br>
</b></div>
</blockquote>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks again,</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Rob</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> macports-dev <macports-dev-bounces@lists.macports.org> on behalf of Robert Kennedy <amtor@hotmail.com><br>
<b>Sent:</b> July 31, 2022 10:16 PM<br>
<b>To:</b> Joshua Root <jmr@macports.org><br>
<b>Cc:</b> MacPorts Development <macports-dev@lists.macports.org><br>
<b>Subject:</b> Re: Help with New Port - M2VDownsizer</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks Joshua.  </div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I have never seen "<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">-Xarch" before in a Makefile.  That looks like very simple and elegant way to address the issue.  I will give it a shot.  I will be able to easily
 verify that it works because Intel builds will fail <span style="background-color:rgb(255,255,255); display:inline!important">with following error</span> if CFLAGS contains the -faltivec flag:</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">
<p class="x_x_p1 x_x_elementToProof" style="margin:0px 0px 0px 12px; text-indent:-12px; font:11px Menlo">
</p>
<blockquote style="margin-top:0; margin-bottom:0">
<div><span style="font-size:11pt">clang: error: invalid argument '-faltivec' only allowed with 'ppc/ppc64'</span></div>
</blockquote>
<p></p>
</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">I am glad to hear that I can use conditional expressions in my Portfiles, if need be.  It looks like I will need to brush up on my Tcl.</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">Thanks again,</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div class="x_x_elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div>Rob</div>
</div>
<div id="x_x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Joshua Root <jmr@macports.org><br>
<b>Sent:</b> July 31, 2022 9:38 PM<br>
<b>To:</b> Robert Kennedy <amtor@hotmail.com><br>
<b>Cc:</b> MacPorts Development <macports-dev@lists.macports.org><br>
<b>Subject:</b> Re: Help with New Port - M2VDownsizer</font>
<div> </div>
</div>
<div class="x_x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_x_PlainText">On 2022-8-1 10:11 , Robert Kennedy wrote:<br>
> Hello everyone!<br>
> <br>
> I am working on a new port, M2VDownzsizer, which is a sister port to the <br>
> recent existing port, M2VRequantiser.  Both ports are command line <br>
> programs that shrink MPEG-2 video and are commonly used when shrinking  <br>
> a DVD-9 video disc to fit onto a much more affordable DVD-5 writable disc.<br>
> <br>
> M2VDownsizer was released as an open source project many years ago and <br>
> was developed as an old XCode project for Macs running PowerPC and Intel <br>
> 32 bit.  The code is quite old.<br>
> <br>
> I have converted the project from an XCode project to a much simpler <br>
> project using a Makefile.  I have also hacked and updated the code so it <br>
> will run on modern compilers.  I also eliminated the need to compile the <br>
> very old libraries in the source code by linking to much more up to date <br>
> libraries available in Macports.  I have even written a man page!  <br>
> M2VDownsizer appears to run just fine on more modern Macs!<br>
> <br>
> Now my challenge is creating a Portfile!  I have a couple of questions:<br>
> <br>
>  1.   How do I tell Macports to copy my Makefile (which I will place in<br>
>     the Files directory along with my source code patches) into my<br>
>     working directory before building?  (The original source never had a<br>
>     Makefile so there is nothing to patch).  P.S.  I could always create<br>
>     my own GitHub project and download the source (with the Makefile)<br>
>     from there.<br>
<br>
post-extract {<br>
     copy ${filespath}/Makefile ${worksrcpath}<br>
}<br>
<br>
>  2. How do I tell Macports to include the -faltivec flag in CFLAGS but<br>
>     only when a ppc build is being done?  I have the following in my<br>
>     Makefile but I suspect it would be much better to address this issue<br>
>     in the Portfile in case an Intel Mac is trying to build a ppc/x86<br>
>     FAT binary:<br>
> <br>
>         ifeq ($(findstring ppc, $(UNAME_P)), ppc)<br>
>               CFLAGS += -faltivec<br>
>               CXXFLAGS += -flativec<br>
>         endif<br>
<br>
You could instead do:<br>
CFLAGS += -Xarch_ppc -faltivec<br>
CXXFLAGS += -Xarch_ppc -faltivec<br>
<br>
That will apply -faltivec only when building for ppc.<br>
<br>
>       3. Is there anything like an "if-then-else" statement in Portfiles?<br>
<br>
Yes, Portfiles are written in Tcl and can use all Tcl's control flow <br>
mechanisms.<br>
<br>
- Josh<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>