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.
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
P.S. I have no way to test ppc or ppc64 builds and the altivec related code.
So I have left the altivec source code alone.
3. Is there anything like an "if-then-else" statement in Portfiles?
I am a newbie when it comes to writing Portfiles. So, any advice and guidance
that you can provide would be greatly appreciated.
RobK88