Help with New Port - M2VDownsizer

Robert Kennedy amtor at
Mon Aug 1 14:54:56 UTC 2022


I can confirm that your elegant solution using CFLAGS += -Xarch_ppc -faltivec does work.  The compile succeeds.  But clang does throw this warning message:

clang: warning: argument unused during compilation: '-Xarch_ppc -faltivec'

P.S.  To cover the ppc64 arch, I also added the following to the Makefile:

CFLAGS += -Xarch_ppc64 -faltivec

Thanks again,


From: macports-dev <macports-dev-bounces at> on behalf of Robert Kennedy <amtor at>
Sent: July 31, 2022 10:16 PM
To: Joshua Root <jmr at>
Cc: MacPorts Development <macports-dev at>
Subject: Re: Help with New Port - M2VDownsizer

Thanks Joshua.

I have never seen "-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 with following error if CFLAGS contains the -faltivec flag:

clang: error: invalid argument '-faltivec' only allowed with 'ppc/ppc64'

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.

Thanks again,

From: Joshua Root <jmr at>
Sent: July 31, 2022 9:38 PM
To: Robert Kennedy <amtor at>
Cc: MacPorts Development <macports-dev at>
Subject: Re: Help with New Port - M2VDownsizer

On 2022-8-1 10:11 , Robert Kennedy wrote:
> Hello everyone!
> I am working on a new port, M2VDownzsizer, which is a sister port to the
> recent existing port, M2VRequantiser.  Both ports are command line
> programs that shrink MPEG-2 video and are commonly used when shrinking
> a DVD-9 video disc to fit onto a much more affordable DVD-5 writable disc.
> M2VDownsizer was released as an open source project many years ago and
> was developed as an old XCode project for Macs running PowerPC and Intel
> 32 bit.  The code is quite old.
> I have converted the project from an XCode project to a much simpler
> project using a Makefile.  I have also hacked and updated the code so it
> will run on modern compilers.  I also eliminated the need to compile the
> very old libraries in the source code by linking to much more up to date
> libraries available in Macports.  I have even written a man page!
> M2VDownsizer appears to run just fine on more modern Macs!
> Now my challenge is creating a Portfile!  I have a couple of questions:
>  1.   How do I tell Macports to copy my Makefile (which I will place in
>     the Files directory along with my source code patches) into my
>     working directory before building?  (The original source never had a
>     Makefile so there is nothing to patch).  P.S.  I could always create
>     my own GitHub project and download the source (with the Makefile)
>     from there.

post-extract {
     copy ${filespath}/Makefile ${worksrcpath}

>  2. How do I tell Macports to include the -faltivec flag in CFLAGS but
>     only when a ppc build is being done?  I have the following in my
>     Makefile but I suspect it would be much better to address this issue
>     in the Portfile in case an Intel Mac is trying to build a ppc/x86
>     FAT binary:
>         ifeq ($(findstring ppc, $(UNAME_P)), ppc)
>               CFLAGS += -faltivec
>               CXXFLAGS += -flativec
>         endif

You could instead do:
CFLAGS += -Xarch_ppc -faltivec
CXXFLAGS += -Xarch_ppc -faltivec

That will apply -faltivec only when building for ppc.

>       3. Is there anything like an "if-then-else" statement in Portfiles?

Yes, Portfiles are written in Tcl and can use all Tcl's control flow

- Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-dev mailing list