Skip to content

Commit

Permalink
mingw32: Build inside current git checkout.
Browse files Browse the repository at this point in the history
Add checks to only build components as necessary. Also added a "clean"
argument to start over from scratch.
  • Loading branch information
linuxdude42 committed Jan 11, 2022
1 parent 8274de4 commit 0823de5
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 108 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ uic_wrapper.sh
*.profdata
__pycache__
mocinclude.opt
build
1 change: 0 additions & 1 deletion platform/win32/w64-mingw32/.gitignore

This file was deleted.

248 changes: 149 additions & 99 deletions platform/win32/w64-mingw32/MythBuild_MXE_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,107 +8,157 @@ sudo apt-get --assume-yes install \
libtool libtool-bin ruby intltool p7zip-full python \
pkg-config yasm mmv

echo "Creating build tree"
export buildPath=$PWD"/build"
mkdir -p $buildPath
buildRoot=$PWD
while test ! -e "$buildRoot/.git" ; do
buildRoot=${buildRoot%/*}
if test "x$buildRoot" == "x" ; then
echo "Cannot find .git file or directory. Exiting."
exit
fi
done
export buildRoot
echo "Build root is $buildRoot"

echo "Settings paths"
export buildPath=$buildRoot"/build"
export PATH=$buildPath"/mxe/usr/bin":$PATH

if test "x$1" == "xclean" ; then
echo "Removing build tree"
rm -rf $buildPath
fi

if test -e "$buildPath" ; then
echo "Build tree already exists"
else
echo "Creating build tree"
mkdir -p $buildPath/install/bin/plugins
mkdir -p $buildPath/themes
fi

if test -e "$buildPath/themes/Mythbuntu-classic" ; then
echo "MythTV themes already exist"
else
echo "Cloning MythTV themes"
cd $buildPath/themes
git clone https://github.com/paul-h/MythCenterXMAS-wide.git
git clone https://github.com/wesnewell/Functionality
git clone https://github.com/MythTV-Themes/TintedGlass
git clone https://github.com/MythTV-Themes/Readability
git clone https://github.com/MythTV-Themes/Steppes
git clone https://github.com/MythTV-Themes/Retro-wide
git clone https://github.com/MythTV-Themes/LCARS
git clone https://github.com/MythTV-Themes/Childish
git clone https://github.com/MythTV-Themes/Arclight
git clone https://github.com/MythTV-Themes/Mythbuntu
git clone https://github.com/MythTV-Themes/blue-abstract-wide
git clone https://github.com/MythTV-Themes/Mythbuntu-classic
fi

cd $buildPath
mkdir -p install/bin/plugins
mkdir -p themes

echo "Cloning MythTV themes"
cd $buildPath/themes
git clone https://github.com/paul-h/MythCenterXMAS-wide.git
git clone https://github.com/wesnewell/Functionality
git clone https://github.com/MythTV-Themes/TintedGlass
git clone https://github.com/MythTV-Themes/Readability
git clone https://github.com/MythTV-Themes/Steppes
git clone https://github.com/MythTV-Themes/Retro-wide
git clone https://github.com/MythTV-Themes/LCARS
git clone https://github.com/MythTV-Themes/Childish
git clone https://github.com/MythTV-Themes/Arclight
git clone https://github.com/MythTV-Themes/Mythbuntu
git clone https://github.com/MythTV-Themes/blue-abstract-wide
git clone https://github.com/MythTV-Themes/Mythbuntu-classic
cd ..

echo "Cloning MXE"
git clone https://github.com/mxe/mxe.git

echo "Add SQL to QT"
sed -i 's/-no-sql-mysql /\//g' $buildPath/mxe/src/qt.mk

cd mxe
sudo make cc MXE_PLUGIN_DIRS=plugins/gcc8 MXE_TARGETS='i686-w64-mingw32.shared' vulkan-loader vulkan-headers qt5 nasm yasm libsamplerate taglib zlib gnutls mman-win32 pthreads libxml2 libdvdcss x264 x265 lame libass qtwebkit xvidcore libvpx vorbis flac
cd ..

find . -name \*.dll -exec cp {} \install/bin \;
if test -d "mxe" ; then
echo "MXE already exists"
else
echo "Cloning MXE"
git clone https://github.com/mxe/mxe.git

export PATH=$buildPath"/mxe/usr/bin":$PATH
sudo chmod -R 777 $buildPath/mxe

echo -e "#define RTLD_LAZY 0 \n#define HAVE_DVDCSS_DVDCSS_H" | sudo -E tee $buildPath/mxe/usr/i686-w64-mingw32.shared/include/dlfcn.h

sudo -E sed -i 's/#define GetUserName __MINGW_NAME_AW(GetUserName)//g' $buildPath/mxe/usr/i686-w64-mingw32.shared/include/winbase.h
sudo -E sed -i 's/#define CopyFile __MINGW_NAME_AW(CopyFile)//g' $buildPath/mxe/usr/i686-w64-mingw32.shared/include/winbase.h
sudo -E sed -i 's/#define MoveFile __MINGW_NAME_AW(MoveFile)//g' $buildPath/mxe/usr/i686-w64-mingw32.shared/include/winbase.h

sudo cp $buildPath/mxe/usr/x86_64-pc-linux-gnu/bin/yasm $buildPath//mxe/usr/bin/yasm
sudo cp $buildPath/mxe/usr/bin/i686-w64-mingw32.shared-pkg-config $buildPath//mxe/usr/bin/pkg-config
sudo cp -R $buildPath/mxe/usr/lib/gcc/i686-w64-mingw32.shared/8.4.0/include/c++ $buildPath/mxe/usr/lib/gcc/i686-w64-mingw32.shared/8.4.0/include

cp $buildPath/mythtv/platform/win32/w64-mingw32/Patches/libexiv2.patch $buildPath/mythtv/libexiv2.patch
cd mythtv
git apply libexiv2.patch -v
rm libexiv2.patch
cd ..

echo "Compiling libudfread"
GIT_SSL_NO_VERIFY= git clone https://code.videolan.org/videolan/libudfread.git
cd libudfread
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --host=i686-w64-mingw32.shared
# libtool won't build this as a shared library without this flag.
sed -i 's/LDFLAGS = /LDFLAGS = -no-undefined/' Makefile
make -j$(nproc)
sudo make install
cd ..

GIT_SSL_NO_VERIFY= git clone https://code.videolan.org/videolan/libbluray.git
cd $buildPath/libbluray
GIT_SSL_NO_VERIFY= git submodule update --init

sudo -E chmod -R 777 $buildPath/libbluray

echo "Compiling libbluray"
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --disable-examples --with-freetype --with-libxml2 --disable-bdjava-jar --host=i686-w64-mingw32.shared
make -j$(nproc)
make install
cd ..

echo "Compiling libzip"
git clone https://github.com/nih-at/libzip.git
sudo -E chmod -R 777 $buildPath/libzip
cd libzip
$buildPath/mxe/usr/bin/i686-w64-mingw32.shared-cmake $buildPath/libzip
make -j$(nproc)
make install
cd ..

echo "Compiling SoundTouch"
GIT_SSL_NO_VERIFY= git clone https://codeberg.org/soundtouch/soundtouch.git
sudo -E chmod -R 777 $buildPath/soundtouch
cd soundtouch
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --host=i686-w64-mingw32.shared
sed -i 's/LDFLAGS = /LDFLAGS = -no-undefined/' $buildPath/soundtouch/source/SoundTouch/Makefile
make -j$(nproc)
make install
cd ..

echo "Install endian.h"
git clone https://gist.github.com/PkmX/63dd23f28ba885be53a5
sudo -E cp $buildPath/63dd23f28ba885be53a5/portable_endian.h $buildPath/mxe/usr/i686-w64-mingw32.shared/include/endian.h
echo "Add SQL to QT"
sed -i 's/-no-sql-mysql /\//g' $buildPath/mxe/src/qt.mk

cd mxe
make cc MXE_PLUGIN_DIRS=plugins/gcc8 MXE_TARGETS='i686-w64-mingw32.shared' vulkan-loader vulkan-headers qt5 nasm yasm libsamplerate taglib zlib gnutls mman-win32 pthreads libxml2 libdvdcss x264 x265 lame libass qtwebkit xvidcore libvpx vorbis flac
cd ..

find . -name \*.dll -exec cp {} \install/bin \;

chmod -R 755 $buildPath/mxe

echo -e "#define RTLD_LAZY 0 \n#define HAVE_DVDCSS_DVDCSS_H" | tee $buildPath/mxe/usr/i686-w64-mingw32.shared/include/dlfcn.h

sed -i -e 's/#define GetUserName __MINGW_NAME_AW(GetUserName)//g' \
-e 's/#define CopyFile __MINGW_NAME_AW(CopyFile)//g' \
-e 's/#define MoveFile __MINGW_NAME_AW(MoveFile)//g' \
$buildPath/mxe/usr/i686-w64-mingw32.shared/include/winbase.h

#sudo apt-get --assume-yes remove yasm

cp $buildPath/mxe/usr/x86_64-pc-linux-gnu/bin/yasm $buildPath/mxe/usr/bin/yasm
cp $buildPath/mxe/usr/bin/i686-w64-mingw32.shared-pkg-config $buildPath/mxe/usr/bin/pkg-config
cp -R $buildPath/mxe/usr/lib/gcc/i686-w64-mingw32.shared/8.4.0/include/c++ $buildPath/mxe/usr/lib/gcc/i686-w64-mingw32.shared/8.4.0/include
fi


cd $buildPath
if test -d "libudfread" ; then
echo "Directory libudfread already exists"
else
echo "Compiling libudfread"
GIT_SSL_NO_VERIFY= git clone https://code.videolan.org/videolan/libudfread.git
cd libudfread
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --host=i686-w64-mingw32.shared
# libtool won't build this as a shared library without this flag.
sed -i 's/LDFLAGS = /LDFLAGS = -no-undefined/' Makefile
make -j$(nproc)
make install
fi


cd $buildPath
if test -d "libbluray" ; then
echo "Directory libbluray already exists"
else
GIT_SSL_NO_VERIFY= git clone https://code.videolan.org/videolan/libbluray.git
chmod -R 755 libbluray
cd libbluray
GIT_SSL_NO_VERIFY= git submodule update --init

echo "Compiling libbluray"
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --disable-examples --with-freetype --with-libxml2 --disable-bdjava-jar --host=i686-w64-mingw32.shared
make -j$(nproc)
make install
fi


cd $buildPath
if test -d "libzip" ; then
echo "Directory libzip already exists"
else
echo "Compiling libzip"
git clone https://github.com/nih-at/libzip.git
chmod -R 755 libzip
cd libzip
$buildPath/mxe/usr/bin/i686-w64-mingw32.shared-cmake $buildPath/libzip
make -j$(nproc)
make install
fi


cd $buildPath
if test -d "soundtouch" ; then
echo "Directory soundtouch already exists"
else
echo "Compiling SoundTouch"
GIT_SSL_NO_VERIFY= git clone https://codeberg.org/soundtouch/soundtouch.git
chmod -R 755 soundtouch
cd soundtouch
./bootstrap
./configure --prefix=$buildPath/mxe/usr/i686-w64-mingw32.shared --host=i686-w64-mingw32.shared
sed -i 's/LDFLAGS = /LDFLAGS = -no-undefined/' $buildPath/soundtouch/source/SoundTouch/Makefile
make -j$(nproc)
make install
fi


cd $buildPath
if test -f "$buildPath/mxe/usr/i686-w64-mingw32.shared/include/endian.h" ; then
echo "Endian.h already exists"
else
echo "Install endian.h"
git clone https://gist.github.com/PkmX/63dd23f28ba885be53a5 portable_endian
cp $buildPath/portable_endian/portable_endian.h $buildPath/mxe/usr/i686-w64-mingw32.shared/include/endian.h
fi


echo "Done"
41 changes: 33 additions & 8 deletions platform/win32/w64-mingw32/MythBuild_MXE_mythtv.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
#!/bin/bash

export buildPath=$PWD"/build"
buildRoot=$PWD
while test ! -e "$buildRoot/.git" ; do
buildRoot=${buildRoot%/*}
if test "x$buildRoot" == "x" ; then
echo "Cannot find root directory containing .git file or directory. Exiting."
exit
fi
done
export buildRoot
echo "Build root is $buildRoot"

echo "Settings paths"
export buildPath=$buildRoot"/build"
export PATH=$buildPath"/mxe/usr/bin":$PATH
export qt5=$buildPath"/mxe/usr/i686-w64-mingw32.shared/qt5"
export in1=$buildPath"/mxe/usr/i686-w64-mingw32.shared"

git clone https://github.com/MythTV/mythtv.git
if test "x$1" == "xclean" ; then
echo "Removing MythTV build directory"
rm -rf $buildPath/mythtv
fi

if test -e "$buildPath/mythtv" ; then
echo "MythTV build directory exists"
else
echo "Creating MythTV build directory"
mkdir -p $buildPath/mythtv
cd $buildRoot
cp -al mythplugins mythtv platform themestringstool $buildPath/mythtv
fi

cd $buildPath/mythtv
#git clean -xfd .
#git fetch me
#git reset --hard me/master
#cp platform/win32/w64-mingw32/Patches/libexiv2.patch libexiv2.patch
#git apply libexiv2.patch -v
#rm libexiv2.patch
if test -e .exif_patched ; then
echo "libexif source already patched"
else
echo "Patching libexif source"
patch -p1 < platform/win32/w64-mingw32/Patches/libexiv2.patch
touch .exif_patched
fi

echo "Compiling mythtv"
cd $buildPath/mythtv/mythtv
Expand Down

0 comments on commit 0823de5

Please sign in to comment.