1#!/bin/sh 2 3# 4# make-bindist_win32.sh -- Make a binary distribution for the Windows GTK3 port. 5# 6# Written by 7# Marco van den Heuvel <blackystardust68@yahoo.com> 8# Greg King <gregdk@users.sf.net> 9# 10# This file is part of VICE, the Versatile Commodore Emulator. 11# See README for copyright notice. 12# 13# This program is free software; you can redistribute it and/or modify 14# it under the terms of the GNU General Public License as published by 15# the Free Software Foundation; either version 2 of the License, or 16# (at your option) any later version. 17# 18# This program is distributed in the hope that it will be useful, 19# but WITHOUT ANY WARRANTY; without even the implied warranty of 20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21# GNU General Public License for more details. 22# 23# You should have received a copy of the GNU General Public License 24# along with this program; if not, write to the Free Software 25# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 26# 02111-1307 USA. 27# 28# Usage: make-bindist.sh <strip> <vice-version> <--enable-arch> <zip|nozip> <x64sc-included> <top-srcdir> <cpu> <abs-top-builddir> <cross> <objdump> <compiler> 29# $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 30# 31 32STRIP=$1 33VICEVERSION=$2 34ENABLEARCH=$3 35ZIPKIND=$4 36X64SCINC=$5 37TOPSRCDIR=$6 38CPU=$7 39TOPBUILDDIR=$8 40CROSS=$9 41 42shift 43OBJDUMP=$9 44 45shift 46COMPILER=$9 47 48 49# Try to get the SVN revision 50#echo "Trying to get SVN revision" 51SVN_SUFFIX="" 52svnrev_string=`svnversion $TOPSRCDIR` 53if test "$?" != "0"; then 54 #echo "No svnversion found" 55 # nop: 56 : 57else 58 # Choose the second number (usually higher) if it exists; drop letter suffixes. 59 svnrev=`echo "$svnrev_string" | sed 's/^\([0-9]*:\)*\([0-9]*\)*.*/\2/'` 60 #echo "svnrev string: $svnrev" 61 # Only a number is extracted. 62 if test -n "$svnrev" 63 then SVN_SUFFIX="-r$svnrev" 64 fi 65fi 66 67 68get_dll_deps() 69{ 70 for j in `find $BUILDPATH -name "*.dll"` 71 do 72 dlls=`$OBJDUMP -p $j | sed 's| |\n|g' | grep -F ".dll"` 73 for i in $dlls 74 do 75 if test -e $dlldir/$i; then 76 cp $dlldir/$i $BUILDPATH 77 fi 78 done 79 done 80} 81 82 83if test x"$CPU" = "xx86_64" -o x"$CPU" = "xamd64"; then 84 WINXX="win64" 85else 86 WINXX="win32" 87fi 88 89if test x"$X64SCINC" = "xyes"; then 90 SCFILE="x64sc" 91else 92 SCFILE="" 93fi 94 95EMULATORS="x64 xscpu64 x64dtv $SCFILE x128 xcbm2 xcbm5x0 xpet xplus4 xvic vsid" 96CONSOLE_TOOLS="c1541 cartconv petcat" 97EXECUTABLES="$EMULATORS $CONSOLE_TOOLS" 98unset CONSOLE_TOOLS EMULATORS SCFILE X64SCINC CPU svnrev_string 99 100for i in $EXECUTABLES; do 101 if [ ! -x $TOPBUILDDIR/src/$i.exe ]; then 102 echo 'Error: executable files not found; do a "make" first.' 103 exit 1 104 fi 105done 106 107 108GTK3NAME="GTK3VICE" 109BUILDPATH="$TOPBUILDDIR/$GTK3NAME-$VICEVERSION-$WINXX$SVN_SUFFIX" 110#echo "BUILDPATH = $BUILDPATH" 111 112 113echo "Removing an old $BUILDPATH ..." 114rm -r -f $BUILDPATH 115 116echo "Generating a $WINXX GTK3 port binary distribution..." 117mkdir $BUILDPATH 118 119for i in $EXECUTABLES; do 120 cp $TOPBUILDDIR/src/$i.exe $BUILDPATH 121 $STRIP $BUILDPATH/$i.exe 122done 123 124if test x"$CROSS" != "xtrue"; then 125 126# The following lines assume that this script is run by MSYS2. 127 cp `ntldd -R $BUILDPATH/x64.exe|gawk '/\\\\bin\\\\/{print $3;}'|cygpath -f -` $BUILDPATH 128 cp $MINGW_PREFIX/bin/lib{croco-0.6-3,lzma-5,rsvg-2-2,xml2-2}.dll $BUILDPATH 129 cp $MINGW_PREFIX/bin/gspawn-win??-helper-console.exe $BUILDPATH 130 cd $MINGW_PREFIX 131 cp --parents lib/gdk-pixbuf-2.0/2.*/loaders.cache lib/gdk-pixbuf-2.0/2.*/loaders/libpixbufloader-{png,svg,xpm}.dll $BUILDPATH 132 cp --parents share/glib-2.0/schemas/gschemas.compiled $BUILDPATH 133 cp --parents -a share/icons/Adwaita $BUILDPATH 134 cp --parents share/icons/hicolor/index.theme $BUILDPATH 135 cd - >/dev/null 136else 137 138# The following lines assume a cross compiler, 139# and the DLLs installed in the dll dir. of that toolchain. 140 libm=`i686-w64-mingw32-gcc -print-file-name=libm.a` 141 location=`dirname $libm` 142 loc=`dirname $location` 143 dlldir="$loc/dll" 144 dlls=`$OBJDUMP -p src/x64.exe | sed 's| |\n|g' | grep -F ".dll"` 145 for i in $dlls 146 do 147 if test -e $dlldir/$i; then 148 cp $dlldir/$i $BUILDPATH 149 fi 150 done 151 cp $dlldir/lib{bz2-1,freetype-6,gcc_s_dw2-1,croco-0.6-3,lzma-5,rsvg-2-2,xml2-2}.dll $BUILDPATH 152 gccname=`$COMPILER -print-file-name=libgcc.a` 153 gccdir=`dirname $gccname` 154 cp $gccdir/libgcc*.dll $BUILDPATH 155 get_dll_deps 156 get_dll_deps 157 current=`pwd` 158 cd $loc 159 cp --parents lib/gdk-pixbuf-2.0/2.*/loaders.cache lib/gdk-pixbuf-2.0/2.*/loaders/libpixbufloader-{png,svg,xpm}.dll $BUILDPATH 160 cp --parents share/glib-2.0/schemas/gschemas.compiled $BUILDPATH 161 cp --parents -a share/icons/Adwaita $BUILDPATH 162 cp --parents share/icons/hicolor/index.theme $BUILDPATH 163 cd $current 164fi 165 166cp -a $TOPSRCDIR/data/C128 $TOPSRCDIR/data/C64 $BUILDPATH 167cp -a $TOPSRCDIR/data/C64DTV $TOPSRCDIR/data/CBM-II $BUILDPATH 168cp -a $TOPSRCDIR/data/DRIVES $TOPSRCDIR/data/PET $BUILDPATH 169cp -a $TOPSRCDIR/data/PLUS4 $TOPSRCDIR/data/PRINTER $BUILDPATH 170cp -a $TOPSRCDIR/data/SCPU64 $TOPSRCDIR/data/VIC20 $BUILDPATH 171rm -f `find $BUILDPATH -name "Makefile*"` 172rm -f `find $BUILDPATH -name "sdl_*"` 173mkdir $BUILDPATH/gui 174cp $TOPBUILDDIR/src/arch/gtk3/data/vice.gresource $BUILDPATH/gui 175cp $TOPSRCDIR/data/fonts/CBM.ttf $BUILDPATH/gui 176cp -a $TOPSRCDIR/doc/html $BUILDPATH 177cp -a -u $TOPBUILDDIR/doc/html $BUILDPATH 178rm -f $BUILDPATH/html/Makefile* $BUILDPATH/html/checklinks.sh $BUILDPATH/html/texi2html 179rm -f $BUILDPATH/html/robots.txt $BUILDPATH/html/sitemap.xml 180rm -f $BUILDPATH/html/COPYING $BUILDPATH/html/NEWS 181cp $TOPSRCDIR/COPYING $TOPSRCDIR/FEEDBACK $TOPSRCDIR/NEWS $TOPSRCDIR/README $BUILDPATH 182cp $TOPSRCDIR/doc/readmes/Readme-GTK3.txt $BUILDPATH 183mkdir $BUILDPATH/doc 184cp $TOPBUILDDIR/doc/vice.pdf $BUILDPATH/doc 185cp $TOPBUILDDIR/doc/vice.{chm,hlp} $BUILDPATH/doc 186 187 188if test x"$ZIPKIND" = "xzip"; then 189 rm -f $BUILDPATH.zip 190 cd $BUILDPATH/.. 191 if test x"$ZIP" = "x" 192 then zip -r -9 -q $BUILDPATH.zip $GTK3NAME-$VICEVERSION-$WINXX$SVN_SUFFIX 193 else $ZIP $BUILDPATH.zip $GTK3NAME-$VICEVERSION-$WINXX$SVN_SUFFIX 194 fi 195 rm -r -f $BUILDPATH 196 echo "$WINXX GTK3 port binary distribution archive generated as $BUILDPATH.zip" 197else echo "$WINXX GTK3 port binary distribution directory generated as $BUILDPATH/" 198fi 199 200if test x"$ENABLEARCH" = "xyes"; then 201 echo '' 202 echo 'Warning: The binaries are optimized for your system.' 203 echo 'They might not run on a different system.' 204 echo 'Configure with --enable-arch=no to avoid that.' 205 echo '' 206fi 207