summaryrefslogtreecommitdiff
path: root/multimedia/handbrake/files
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/handbrake/files')
-rw-r--r--multimedia/handbrake/files/patch-configure14
-rw-r--r--multimedia/handbrake/files/patch-contrib-Jamfile285
-rw-r--r--multimedia/handbrake/files/patch-contrib-a52dec-libao-audio_out_oss.c11
-rw-r--r--multimedia/handbrake/files/patch-contrib-libsamplerate-configure20
-rw-r--r--multimedia/handbrake/files/patch-contrib-x264-Makefile20
-rw-r--r--multimedia/handbrake/files/patch-contrib-x264-configure11
-rw-r--r--multimedia/handbrake/files/patch-libhb-fifo.c13
-rw-r--r--multimedia/handbrake/files/patch-libhb-ports.c46
8 files changed, 409 insertions, 11 deletions
diff --git a/multimedia/handbrake/files/patch-configure b/multimedia/handbrake/files/patch-configure
index 90d992da8cfd..f72855dbf91c 100644
--- a/multimedia/handbrake/files/patch-configure
+++ b/multimedia/handbrake/files/patch-configure
@@ -1,5 +1,5 @@
---- configure.orig Thu Feb 23 18:29:33 2006
-+++ configure Sun Jun 25 23:37:46 2006
+--- configure.orig 2007-12-07 17:24:34.000000000 -0600
++++ configure 2007-12-07 17:25:50.000000000 -0600
@@ -1,9 +1,9 @@
#! /bin/sh
@@ -11,14 +11,6 @@
+CXX="${CXX-g++}"
+CCFLAGS="${CFLAGS--Wall -g}"
+OPTIM=""
+ LINKLIBS="-lz"
# System-specific flags
- SYSTEM=`uname -s`
-@@ -36,6 +36,7 @@
- ;;
-
- FreeBSD)
-+ CCFLAGS="$CCFLAGS -Wall"
- DEFINES="$DEFINES SYS_FREEBSD"
- LINKLIBS="$LINKLIBS -pthread"
- ;;
diff --git a/multimedia/handbrake/files/patch-contrib-Jamfile b/multimedia/handbrake/files/patch-contrib-Jamfile
new file mode 100644
index 000000000000..1c8363c4f848
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib-Jamfile
@@ -0,0 +1,285 @@
+--- contrib/Jamfile.orig 2007-10-08 15:57:23.000000000 -0500
++++ contrib/Jamfile 2007-12-07 17:58:44.000000000 -0600
+@@ -23,9 +23,10 @@
+ }
+ actions Wget
+ {
+- $(RM) $(<) &&
+- $(WGET) $(<) `cat $(>)` &&
+- ( touch $(<) || true )
++# $(RM) $(<) &&
++# $(WGET) $(<) `cat $(>)` &&
++# ( touch $(<) || true )
++ true
+ }
+
+ # liba52
+@@ -36,10 +37,9 @@
+ }
+ actions LibA52
+ {
+-
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf a52dec && tar xzf a52dec.tar.gz && cd a52dec && patch -p1 < ../patch-a52dec.patch &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/a52dec && patch -p1 < ../patch-a52dec.patch &&
++ ./configure --prefix=$CONTRIB && $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/liba52.a
+ }
+ Wget $(SUBDIR)/a52dec.tar.gz : $(SUBDIR)/version_a52dec.txt ;
+@@ -58,14 +58,13 @@
+ }
+ actions LibAvCodec
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf ffmpeg && tar xzf ffmpeg.tar.gz &&
+- cd ffmpeg && $(FFMPEG_PATCH) &&
+- ./configure --prefix=$CONTRIB --enable-gpl --enable-pthreads --enable-swscaler --disable-audio-beos --disable-shared --enable-static \
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/ffmpeg && $(FFMPEG_PATCH) &&
++ ./configure --prefix="$CONTRIB" --cc="%%CC%%" --extra-libs="%%PTHREAD_LIBS%%" --enable-gpl --enable-pthreads --enable-swscaler --disable-audio-beos --disable-shared --enable-static --disable-opts \
+ --disable-decoders --enable-decoder=mp2 --disable-parsers --enable-parser=mpegaudio \
+ --disable-encoders --enable-encoder=mpeg4 --enable-encoder=ac3 --enable-encoder=snow \
+ --disable-muxers --enable-muxer=ipod --disable-demuxers --disable-protocols --disable-bsfs &&
+- make && make install &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libavcodec.a
+ }
+ Wget $(SUBDIR)/ffmpeg.tar.gz : $(SUBDIR)/version_ffmpeg.txt ;
+@@ -96,9 +95,9 @@
+ }
+ actions LibDvdCss
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libdvdcss && tar xzf libdvdcss.tar.gz && cd libdvdcss &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libdvdcss &&
++ ./configure --prefix=$CONTRIB && $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libdvdcss.a
+ }
+ Wget $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
+@@ -113,9 +112,9 @@
+ }
+ actions LibDCA
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libdca && tar xzf libdca.tar.gz && cd libdca && patch -p1 < ../patch-libdca.patch &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libdca && patch -p1 < ../patch-libdca.patch &&
++ ./configure --prefix=$CONTRIB && $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libdca.a
+ }
+ Wget $(SUBDIR)/libdca.tar.gz : $(SUBDIR)/version_libdca.txt ;
+@@ -131,10 +130,10 @@
+ {
+ actions LibDvdRead
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libdvdread &&
++ ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libdvdread.a
+ }
+ }
+@@ -143,10 +142,10 @@
+ # configure line.
+ actions LibDvdRead
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libdvdread &&
++ ./configure --prefix=$CONTRIB --disable-shared &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libdvdread.a
+ }
+ }
+@@ -161,10 +160,10 @@
+ }
+ actions LibFaac
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf faac && tar xzf faac.tar.gz && cd faac &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/faac &&
++ ./configure --prefix=$CONTRIB --disable-shared --enable-static &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libfaac.a
+ }
+ Wget $(SUBDIR)/faac.tar.gz : $(SUBDIR)/version_faac.txt ;
+@@ -178,10 +177,10 @@
+ }
+ actions LibMp3Lame
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf lame && tar xzf lame.tar.gz && cd lame &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/lame &&
++ ./configure --prefix=$CONTRIB --disable-shared &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libmp3lame.a
+ }
+ Wget $(SUBDIR)/lame.tar.gz : $(SUBDIR)/version_lame.txt ;
+@@ -197,11 +196,11 @@
+ {
+ actions LibMp4v2
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf mpeg4ip && tar xzf mpeg4ip.tar.gz && cd mpeg4ip &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/mpeg4ip &&
+ patch -p1 < ../patch-mpeg4ip.patch && patch -p0 < ../patch-mpeg4ip-pascal-str.patch &&
+- ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
+- make -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
++ ./bootstrap --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
++ $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
+ cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
+ include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
+ strip -S $CONTRIB/lib/libmp4v2.a
+@@ -211,11 +210,11 @@
+ {
+ actions LibMp4v2
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf mpeg4ip && tar xzf mpeg4ip.tar.gz && cd mpeg4ip &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/mpeg4ip &&
+ patch -p1 < ../patch-mpeg4ip.patch && patch -p1 < ../patch_mpeg4ip_cygwin.patch && patch -p0 < ../patch-mpeg4ip-pascal-str.patch &&
+- ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
+- make -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
++ ./bootstrap --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
++ $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
+ cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
+ include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
+ strip -S $CONTRIB/lib/libmp4v2.a
+@@ -231,10 +230,10 @@
+ }
+ actions LibMkv
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libmkv && tar xzf libmkv.tar.gz && cd libmkv &&
+- ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libmkv &&
++ ./configure --disable-shared --enable-static --prefix=$CONTRIB &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libmkv.a
+ }
+ Wget $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
+@@ -248,10 +247,10 @@
+ }
+ actions LibMpeg2
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf mpeg2dec && tar xzf mpeg2dec.tar.gz && cd mpeg2dec && patch -p1 < ../patch-libmpeg2.patch &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/mpeg2dec && patch -p1 < ../patch-libmpeg2.patch &&
++ ./configure --prefix=$CONTRIB --disable-shared --disable-sdl &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libmpeg2.a
+ }
+ Wget $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
+@@ -265,10 +264,10 @@
+ }
+ actions LibOgg
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libogg && tar xzf libogg.tar.gz && cd libogg &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libogg &&
++ ./configure --prefix=$CONTRIB --disable-shared &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libogg.a
+ }
+ Wget $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
+@@ -282,10 +281,10 @@
+ }
+ actions LibSampleRate
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libsamplerate && tar xzf libsamplerate.tar.gz && cd libsamplerate &&
+- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libsamplerate &&
++ ./configure --prefix=$CONTRIB --disable-shared &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libsamplerate.a
+ }
+ Wget $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
+@@ -299,10 +298,10 @@
+ }
+ actions LibVorbis
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf libvorbis && tar xzf libvorbis.tar.gz && cd libvorbis &&
+- ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+- make && make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/libvorbis &&
++ ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --disable-shared &&
++ $(MAKE) && $(MAKE) install &&
+ strip -S $CONTRIB/lib/libvorbis.a
+ }
+ Wget $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
+@@ -338,10 +337,10 @@
+ }
+ actions LibX264
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf x264 && tar xzf x264.tar.gz && cd x264 && $(LIBX264_PATCH)
+- ./configure --prefix=$CONTRIB --enable-pthread && make &&
+- make install &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/x264 && $(LIBX264_PATCH)
++ ./configure --prefix=$CONTRIB --enable-pthread && $(MAKE) &&
++ $(MAKE) install &&
+ strip -S $CONTRIB/lib/libx264.a
+ }
+ Wget $(SUBDIR)/x264.tar.gz : $(SUBDIR)/version_x264.txt ;
+@@ -364,10 +363,9 @@
+ }
+ actions LibXvidCore
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf xvidcore && tar xzf xvidcore.tar.gz &&
+- cd xvidcore && $(LIBXVIDCORE_PATCH)
+- cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && make libxvidcore.a &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/xvidcore && $(LIBXVIDCORE_PATCH)
++ cd build/generic/ && ./configure --prefix=$CONTRIB && $(MAKE) libxvidcore.a &&
+ cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
+ cp ../../src/xvid.h $CONTRIB/include/ &&
+ strip -S $CONTRIB/lib/libxvidcore.a
+@@ -385,10 +383,9 @@
+ }
+ actions Zlib
+ {
+- cd `dirname $(>)` && CONTRIB=`pwd` &&
+- rm -rf zlib && tar xzf zlib.tar.gz &&
+- cd zlib && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
+- make && make install && touch $CONTRIB/.contrib &&
++ CONTRIB=%%CONTRIB%% &&
++ cd $CONTRIB/zlib && ./configure --prefix=$CONTRIB &&
++ $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
+ strip -S $CONTRIB/lib/libz.a
+ }
+ Wget $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
diff --git a/multimedia/handbrake/files/patch-contrib-a52dec-libao-audio_out_oss.c b/multimedia/handbrake/files/patch-contrib-a52dec-libao-audio_out_oss.c
new file mode 100644
index 000000000000..6ff734192f84
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib-a52dec-libao-audio_out_oss.c
@@ -0,0 +1,11 @@
+--- ../../work/HandBrake/contrib/a52dec/libao/audio_out_oss.c 2002-04-28 12:23:02.000000000 +0200
++++ contrib/a52dec/libao/audio_out_oss.c 2007-12-06 03:06:05.000000000 +0100
+@@ -35,7 +35,7 @@
+ #if defined(__OpenBSD__)
+ #include <soundcard.h>
+ #elif defined(__FreeBSD__)
+-#include <machine/soundcard.h>
++#include <sys/soundcard.h>
+ #ifndef AFMT_S16_NE
+ #include <machine/endian.h>
+ #if BYTE_ORDER == LITTLE_ENDIAN
diff --git a/multimedia/handbrake/files/patch-contrib-libsamplerate-configure b/multimedia/handbrake/files/patch-contrib-libsamplerate-configure
new file mode 100644
index 000000000000..9d8ed481062e
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib-libsamplerate-configure
@@ -0,0 +1,20 @@
+--- ../../work/HandBrake/contrib/libsamplerate/configure 2004-09-12 04:57:51.000000000 +0200
++++ contrib/libsamplerate/configure 2007-12-06 03:14:12.000000000 +0100
+@@ -22293,7 +22293,7 @@
+ # Now use the information from the checking stage.
+
+ # Need to make examples directory before tests directory.
+-subdirs="src doc examples tests"
++subdirs="src doc examples"
+
+
+ cat >>confdefs.h <<\_ACEOF
+@@ -22321,7 +22321,7 @@
+
+
+
+- ac_config_files="$ac_config_files Makefile src/Version_script Win32/Makefile Win32/Makefile.mingw src/Makefile examples/Makefile tests/Makefile doc/Makefile libsamplerate.spec samplerate.pc"
++ ac_config_files="$ac_config_files Makefile src/Version_script Win32/Makefile Win32/Makefile.mingw src/Makefile examples/Makefile doc/Makefile libsamplerate.spec samplerate.pc"
+
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
diff --git a/multimedia/handbrake/files/patch-contrib-x264-Makefile b/multimedia/handbrake/files/patch-contrib-x264-Makefile
new file mode 100644
index 000000000000..a54ac78e0140
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib-x264-Makefile
@@ -0,0 +1,20 @@
+--- ../HandBrake_old/contrib/x264/Makefile 2007-07-15 22:45:03.000000000 +0200
++++ contrib/x264/Makefile 2007-12-06 01:17:21.000000000 +0100
+@@ -18,7 +18,7 @@
+ endif
+
+ # MMX/SSE optims
+-ifeq ($(ARCH),X86)
++ifeq ($(ARCH),i386)
+ ifneq ($(AS),)
+ SRCS += common/i386/mc-c.c common/i386/predict-c.c
+ ASMSRC = common/i386/dct-a.asm common/i386/cpu-a.asm \
+@@ -32,7 +32,7 @@
+ endif
+
+ # MMX/SSE optims
+-ifeq ($(ARCH),X86_64)
++ifeq ($(ARCH),amd64)
+ ifneq ($(AS),)
+ SRCS += common/i386/mc-c.c common/i386/predict-c.c
+ ASMSRC = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
diff --git a/multimedia/handbrake/files/patch-contrib-x264-configure b/multimedia/handbrake/files/patch-contrib-x264-configure
new file mode 100644
index 000000000000..af3ef6ed31c0
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib-x264-configure
@@ -0,0 +1,11 @@
+--- ../HandBrake_old/contrib/x264/configure 2007-07-15 22:45:03.000000000 +0200
++++ contrib/x264/configure 2007-12-06 01:16:03.000000000 +0100
+@@ -160,7 +160,7 @@
+ fi
+ as_check || AS="nasm"
+ ;;
+- x86_64)
++ x86_64 | amd64)
+ ARCH="X86_64"
+ AS="yasm"
+ ASFLAGS="-f elf -m amd64"
diff --git a/multimedia/handbrake/files/patch-libhb-fifo.c b/multimedia/handbrake/files/patch-libhb-fifo.c
new file mode 100644
index 000000000000..47ef561b47ac
--- /dev/null
+++ b/multimedia/handbrake/files/patch-libhb-fifo.c
@@ -0,0 +1,13 @@
+--- HandBrake_old/libhb/fifo.c 2007-10-08 22:57:08.000000000 +0200
++++ libhb/fifo.c 2007-12-04 05:55:37.000000000 +0100
+@@ -6,9 +6,7 @@
+
+ #include "hb.h"
+
+-#ifndef SYS_DARWIN
+-#include <malloc.h>
+-#endif
++#include <stdlib.h>
+
+ /* Fifo */
+ struct hb_fifo_s
diff --git a/multimedia/handbrake/files/patch-libhb-ports.c b/multimedia/handbrake/files/patch-libhb-ports.c
new file mode 100644
index 000000000000..ac4b7ade63dc
--- /dev/null
+++ b/multimedia/handbrake/files/patch-libhb-ports.c
@@ -0,0 +1,46 @@
+--- HandBrake_old/libhb/ports.c 2007-10-08 22:57:08.000000000 +0200
++++ libhb/ports.c 2007-12-04 07:48:47.000000000 +0100
+@@ -28,6 +28,11 @@
+ #include <netinet/in.h>
+ //#endif
+
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #include "hb.h"
+
+ /************************************************************************
+@@ -105,21 +110,17 @@
+ cpu_count = info.cpu_count;
+ }
+
+-#elif defined( SYS_DARWIN ) || defined( SYS_FREEBSD )
+- FILE * info;
+- char buffer[16];
+-
+- if( ( info = popen( "/usr/sbin/sysctl hw.ncpu", "r" ) ) )
++#elif defined(__FreeBSD__)
+ {
+- memset( buffer, 0, 16 );
+- if( fgets( buffer, 15, info ) )
+- {
+- if( sscanf( buffer, "hw.ncpu: %d", &cpu_count ) != 1 )
+- {
+- cpu_count = 1;
+- }
+- }
+- fclose( info );
++ int mib[2];
++ size_t len;
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ len = sizeof(cpu_count);
++
++ if(sysctl(mib, 2, &cpu_count, &len, NULL, 0) != 0)
++ cpu_count = 1;
+ }
+
+ #elif defined( SYS_LINUX )