Re: Help with New Port - M2VDownsizer
On Aug 5, 2022, at 18:14, Robert Kennedy wrote: > I have been playing around with CFLAGS += -Xarch_ppc -faltivec in my > Makefile, as suggested by Josh. > > I noticed that if I include CFLAGS += -Xarch_ppc -faltivec in my Makefile, > the output from the clang compiler gets garbled but the M2VDownsizerbinary > appears to build fine. > E,g, > /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 > > 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 > usppc clang: warning: ar-faltedc guiv d-fmeecuralnt' > ing compilatclang: warning: ioti uarn: '-Xarch_ppc -faltivec' > clang: warning: argument unused during compilation: '-Xarch_ppc6nguvs4 uemece' > d-faltivclang: nt decu' > unriwarning: argument unused during compilation: '-Xarch_ppc64 -faltivec' > ng compilation: '-Xarch_ppc64 -faltivec' > used during compilation: '-Xarch_ppc64 -faltivec' > > I can avoid this garbled output if I turn off parallel builds by including > the following in the Portfile: > > use_parallel_build no > > What is recommended in these circumstances considering that the garbled > output does not appear to affect building the final binary? Should I turn > off parallel builds in the Portfile? No, you should leave parallel building on because it speeds up builds on multiprocessor machines. If bugs are reported against a port and the error messages in the log are too garbled to decipher due to parallel building, ask the user to rerun the build with parallel building disabled.
Re: Help with New Port - M2VDownsizer
I have been playing around with CFLAGS += -Xarch_ppc -faltivec in my Makefile, as suggested by Josh. I noticed that if I include CFLAGS += -Xarch_ppc -faltivec in my Makefile, the output from the clang compiler gets garbled but the M2VDownsizer binary appears to build fine. E,g, /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 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 usppc clang: warning: ar-faltedc guiv d-fmeecuralnt' ing compilatclang: warning: ioti uarn: '-Xarch_ppc -faltivec' clang: warning: argument unused during compilation: '-Xarch_ppc6nguvs4 uemece' d-faltivclang: nt decu' unriwarning: argument unused during compilation: '-Xarch_ppc64 -faltivec' ng compilation: '-Xarch_ppc64 -faltivec' used during compilation: '-Xarch_ppc64 -faltivec' I can avoid this garbled output if I turn off parallel builds by including the following in the Portfile: use_parallel_build no What is recommended in these circumstances considering that the garbled output does not appear to affect building the final binary? Should I turn off parallel builds in the Portfile? Rob From: Robert Kennedy Sent: August 1, 2022 10:54 AM To: Joshua Root Cc: MacPorts Development Subject: Re: Help with New Port - M2VDownsizer Joshua, 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, Rob From: macports-dev on behalf of Robert Kennedy Sent: July 31, 2022 10:16 PM To: Joshua Root Cc: MacPorts Development 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, Rob From: Joshua Root Sent: July 31, 2022 9:38 PM To: Robert Kennedy Cc: MacPorts Development 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
Re: Help with New Port - M2VDownsizer
Joshua, 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, Rob From: macports-dev on behalf of Robert Kennedy Sent: July 31, 2022 10:16 PM To: Joshua Root Cc: MacPorts Development 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, Rob From: Joshua Root Sent: July 31, 2022 9:38 PM To: Robert Kennedy Cc: MacPorts Development 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 mechanisms. - Josh
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, Rob From: Joshua Root Sent: July 31, 2022 9:38 PM To: Robert Kennedy Cc: MacPorts Development 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 mechanisms. - Josh
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 mechanisms. - Josh