Ryan,
I have created a patch file to add include guards everywhere in config.h. see
attached. I know it is overkill. But it will address the issue.
I also fixed the inline macro which was wrong.
#define inline __attribute__ ((__always_inline__))
should really be:
#define inline inline __attribute__ ((__always_inline__))
for the code to really work.
I have also patched config.h to address the ARCH issue. It now reads:
#ifndef LINUX
#if defined(__ppc__) || defined(__ppc64__)
#define ARCH_PPC
#elif defined(__i386__)
#define ARCH_X86
#elif defined(__x86_64__)
#define ARCH_X86_64
#elif defined ((__arm64__) && defined(__APPLE__)) || (__aarch64__)
#define ARCH_ARM64
#else
#define ARCH_X86
#endif
#endif
But it looks like ARCH_PPC, ARCH_X86 is not used anywhere in the code. It
might have been easier to just remove all this code.
I will check whether the code uses WORDS_BIGENDIAN. If not, I will just patch
out the problematic code:
#ifndef LINUX
#define WORDS_BIGENDIAN 1
#endif
P.S. I have been fixing some other bugs. I will submit a PR soon.
P.P.S. It looks like the developer for M2VDownsizer was Metakine who developed
and sold DVD Remaster for many years before the company was bought out. DVD
Remaster used the open source command line tools M2VRequantiser and
M2VDownsizer to do the real work to shrink DVD-9 discs to DVD-5 discs. (Use
"Show Package contents" on the DVD Remaster Application and you will see these
two binaries along with the GPL-2 license in the Contents/Resources/Modules
directory).
Metakine released the source code for these tools on their website under GPL-2.
Unlike M2VRequantiser, it is hard to find any info on M2VDownsizer on the web.
So I suspect it was written by Metakine. I will add a man page to the port.
If one wants to shrink DVD's, it is best to use M2VRequantiser and M2VDownsizer
in a script.
I have already submitted a port for M2VRequantiser which was approved and added
to Macports. I will submit a PR for the sister port, M2VDownsizer soon. My
port successfully builds an X86_64 binary which runs just fine on my Mac. But
until I do the PR, I will not know for sure if it builds and runs on Big Sur
etc.
Rob
________________________________
From: Ryan Schmidt <[email protected]>
Sent: August 5, 2022 4:38 PM
To: Robert Kennedy <[email protected]>
Cc: MacPorts Developers <[email protected]>
Subject: Re: Issues with config.h
Early in config.h it says:
#ifndef LINUX
#if defined(__ppc__) || defined(__ppc64__)
#define ARCH_PPC
#elif defined(__i386__)
#define ARCH_X86
#endif
#else
#define ARCH_X86
#endif
So, on non-Linux systems, it sets ARCH_PPC when building for 32-bit or 64-bit
PowerPC systems, it sets ARCH_X86 when building for 32-bit Intel systems, and
it sets nothing when building for 64-bit Intel systems and all ARM systems.
Since this software predates Apple Silicon systems you may have some work to do
to patch it to work on those systems, depending on how ARCH_PPC and ARCH_X86
are used in the code.
And these lines at the end of config.h are suspicious:
#ifndef LINUX
#define WORDS_BIGENDIAN 1
#endif
Certainly not all non-Linux systems are big-endian. Intel and Apple Silicon
systems are little-endian.
#ifndef MY_CONFIG_H
#define MY_CONFIG_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1 /* We make some use of C9X and
POSIX and GNU facilities... */
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#elif _FILE_OFFSET_BITS != 64
#undef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#ifndef _LARGEFILE_SOURC
#define _LARGEFILE_SOURCE 1
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE 1
#endif
#ifndef HAVE_PTHREADSTACKSIZE
#define HAVE_PTHREADSTACKSIZE 1
#endif
#ifndef HAVE_PPCCPU
#define HAVE_PPCCPU 1
#endif
#ifndef LINUX
#if defined(__ppc__) || defined(__ppc64__)
#define HAVE_ALTIVEC 1
#elif defined(__i386__)
#endif
#endif
#ifndef HAVE_LIBPTHREAD
#define HAVE_LIBPTHREAD 1
#endif
#ifndef LINUX
#if defined(__ppc__) || defined(__ppc64__)
#define ARCH_PPC
#elif defined(__i386__)
#define ARCH_X86
#elif defined(__x86_64__)
#define ARCH_X86_64
#elif defined ((__arm64__) && defined(__APPLE__)) || (__aarch64__)
#define ARCH_ARM64
#else
#define ARCH_X86
#endif
#endif
#ifndef HAVE_BUILTIN_EXPECT
#define HAVE_BUILTIN_EXPECT
#endif
#ifndef PRID64_STRING_FORMAT
#define PRID64_STRING_FORMAT "lld"
#endif
#ifndef MJPEGTOOLS
#define MJPEGTOOLS 1
#endif
#ifndef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY 1
#endif
#ifndef HAVE_FENV_H
#define HAVE_FENV_H 1
#endif
#ifndef HAVE_INTTYPES_H
#define HAVE_INTTYPES_H 1
#endif
#ifndef HAVE_MEMORY_H
#define HAVE_MEMORY_H 1
#endif
#ifndef HAVE_STDBOOL_H
#define HAVE_STDBOOL_H 1
#endif
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H 1
#endif
#ifndef HAVE_STDLIB_H
#define HAVE_STDLIB_H 1
#endif
#ifndef HAVE_STRINGS_H
#define HAVE_STRINGS_H 1
#endif
#ifndef HAVE_STRING_H
#define HAVE_STRING_H 1
#endif
#ifndef HAVE_SYS_STAT_H
#define HAVE_SYS_STAT_H 1
#endif
#ifndef HAVE_SYS_TIMEB_H
#define HAVE_SYS_TIMEB_H 1
#endif
#ifndef HAVE_SYS_TIME_H
#define HAVE_SYS_TIME_H 1
#endif
#ifndef HAVE_SYS_TYPES_H
#define HAVE_SYS_TYPES_H 1
#endif
#ifndef HAVE_UNISTD_H
#define HAVE_UNISTD_H 1
#endif
#ifndef HAVE___PROGNAME
#define HAVE___PROGNAME
#endif
#ifndef PACKAGE
#define PACKAGE "DVDDownsizer"
#endif
#ifndef PACKAGE_BUGREPORT
#define PACKAGE_BUGREPORT ""
#endif
#ifndef PACKAGE_NAME
#define PACKAGE_NAME ""
#endif
#ifndef PACKAGE_STRING
#define PACKAGE_STRING ""
#endif
#ifndef PACKAGE_TARNAME
#define PACKAGE_TARNAME ""
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION ""
#endif
#define RETSIGTYPE void
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#ifndef STDC_HEADERS
#define STDC_HEADERS 1
#endif
#ifndef VERSION
#define VERSION "0.0.1"
#endif
#ifndef LINUX
#define WORDS_BIGENDIAN 1
#endif
#ifndef X_DISPLAY_MISSING
#define X_DISPLAY_MISSING 1
#endif
#ifndef inline
#define inline inline __attribute__ ((__always_inline__))
#endif
#ifndef restrict
#define restrict __restrict__
#endif
#endif