From f4a164641577d339277c3feb7027ad3cb640184e Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Sun, 29 Jul 2012 19:10:44 -0700 Subject: [PATCH] Added reldbg configuration; pack sources for debugging with 'make dist'; fix build with 64-bit wine --- plat/win32/gtk-win/Makefile | 12 ++++++------ plat/win32/gtk-win/config.sh | 11 ++++++++++- plat/win32/gtk-win/copybin.sh | 10 +++++----- plat/win32/gtk-win/copysrc.sh | 12 ++++++------ plat/win32/gtk-win/copysrcdbg.sh | 24 +++++++++++------------ plat/win32/gtk-win/copyuser.sh | 27 +++++++++++++++++++------- plat/win32/gtk-win/jhbuildrc/jhbuildrc | 6 ++++-- plat/win32/gtk-win/make.sh | 4 +++- plat/win32/mingw-configure | 15 +++++++++----- 9 files changed, 75 insertions(+), 46 deletions(-) diff --git a/plat/win32/gtk-win/Makefile b/plat/win32/gtk-win/Makefile index 76b8b988..471bc10a 100644 --- a/plat/win32/gtk-win/Makefile +++ b/plat/win32/gtk-win/Makefile @@ -36,18 +36,18 @@ bdist: bdist-all: bdist-en bdist dist-src-dbg: - rm -fr $(mgwbuildroot)/src-$(mgwconfig) $(mgwbuildroot)/src-$(mgwconfig).zip $(mgwdir)/copysrcdbg.sh dist-src: - rm -fr $(mgwbuildroot)/medit-deps-src $(mgwdir)/copysrc.sh dist-bin: $(mgwdir)/copybin.sh -dist: dist-src dist-bin bdist +dist: dist-src dist-bin bdist dist-src-dbg -clean: - rm -rf $(mgwbuilddir) $(mgwdestdir) $(mgwdestdir)-en $(mgwbuildroot)/medit-deps-src \ - $(mgwbuildroot)/medit-deps-bin-$mgwconfig.tar.bz2 +clean-dist: + rm -rf $(mgwbuildroot)/dist-$(mgwconfig) + +clean: clean-dist + rm -rf $(mgwbuilddir) $(mgwdestdir) $(mgwdestdir)-en $(mgwdistdir) diff --git a/plat/win32/gtk-win/config.sh b/plat/win32/gtk-win/config.sh index ec0ab656..b079369a 100644 --- a/plat/win32/gtk-win/config.sh +++ b/plat/win32/gtk-win/config.sh @@ -18,7 +18,11 @@ export mgwpythonver=`echo $mgwpythondotver | sed 's/[.]//'` if $mgwlinux; then export mgwpythoninstdir=$HOME/.wine/drive_c/Python$mgwpythonver - export mgwpythonsystem32dir=$HOME/.wine/drive_c/windows/system32 + if [ -d $HOME/.wine/drive_c/windows/syswow64 ]; then + export mgwpythonsystem32dir=$HOME/.wine/drive_c/windows/syswow64 + else + export mgwpythonsystem32dir=$HOME/.wine/drive_c/windows/system32 + fi else export mgwpythoninstdir=/cygdrive/c/Tools/Python$mgwpythonver export mgwpythonsystem32dir=/cygdrive/c/Windows/SysWOW64 @@ -40,6 +44,10 @@ case "$1" in mgwconfig=release shift ;; + --reldbg) + mgwconfig=reldbg + shift + ;; esac export mgwjhbuildsrcdir=$mgwbuildroot/jhbuild @@ -53,3 +61,4 @@ export mgwsourcedir=$mgwbuilddir/source export mgwtargetdir=$mgwbuilddir/target export mgwsourcedir_s=$mgwbuilddir_s/source export mgwtargetdir_s=$mgwbuilddir_s/target +export mgwdistdir=$mgwbuildroot/dist-$mgwconfig diff --git a/plat/win32/gtk-win/copybin.sh b/plat/win32/gtk-win/copybin.sh index 723847d4..46512e00 100755 --- a/plat/win32/gtk-win/copybin.sh +++ b/plat/win32/gtk-win/copybin.sh @@ -4,21 +4,21 @@ export mgwdir=`dirname $0` . $mgwdir/config.sh || exit 1 jhtargetdir=$mgwbuilddir/target -destdir=$mgwbuildroot -tmpdir=$mgwbuildroot/medit-deps-bin-tmp +destdir=$mgwbuildroot/dist-$mgwconfig +tmpdir=$destdir/medit-deps-bin-tmp suffix=`date +%Y%m%d` -tarball=medit-deps-bin-$mgwconfig-$suffix.tar.bz2 +tarball=medit-deps-bin-$mgwconfig-$suffix.zip do_or_die() { echo "$@" "$@" || exit 1 } -do_or_die rm -fr $tmpdir +do_or_die rm -fr $tmpdir $destdir/$tarball do_or_die mkdir -p $tmpdir/gtk-win-build/$mgwconfig do_or_die cp -lfR $jhtargetdir $tmpdir/gtk-win-build/$mgwconfig/ do_or_die cd $tmpdir -do_or_die tar cjf $tarball gtk-win-build +do_or_die zip -r9 $tarball gtk-win-build do_or_die mv $tarball $destdir/ do_or_die cd $destdir do_or_die rm -fr $tmpdir diff --git a/plat/win32/gtk-win/copysrc.sh b/plat/win32/gtk-win/copysrc.sh index 0c8e8084..e027773f 100755 --- a/plat/win32/gtk-win/copysrc.sh +++ b/plat/win32/gtk-win/copysrc.sh @@ -5,8 +5,8 @@ export mgwdir=`dirname $0` jhtarballdir=$mgwbuildroot/tarballs jhsourcedir=$mgwbuilddir/source -destname=medit-deps-src-`date +%Y%m%d` -destdir=$mgwbuildroot/$destname +destname=medit-deps-sources-`date +%Y%m%d` +destdir=$mgwbuildroot/dist-$mgwconfig/$destname do_or_die() { echo "$@" @@ -15,11 +15,11 @@ do_or_die() { cd $mgwbuildroot -do_or_die rm -fr $destdir $destdir.tar.bz2 -do_or_die mkdir $destdir +do_or_die rm -fr $destdir $destdir.zip +do_or_die mkdir -p $destdir do_or_die cp -lfR $jhtarballdir/* $destdir/ -do_or_die mkdir $destdir/tmp +do_or_die mkdir -p $destdir/tmp for proj in pycairo pygobject pygtk; do cd $destdir/tmp || exit 1 hg clone $jhsourcedir/$proj @@ -32,5 +32,5 @@ do_or_die cp -lfR $mgwdir $destdir/gtk-win do_or_die mv $destdir/gtk-win/extra/readme-medit-deps.txt $destdir/readme.txt do_or_die cd $destdir/.. -do_or_die tar cjf $destname.tar.bz2 $destname +do_or_die zip -r $destname.zip $destname do_or_die rm -fr $destname diff --git a/plat/win32/gtk-win/copysrcdbg.sh b/plat/win32/gtk-win/copysrcdbg.sh index fef2ac77..bb094b96 100755 --- a/plat/win32/gtk-win/copysrcdbg.sh +++ b/plat/win32/gtk-win/copysrcdbg.sh @@ -5,25 +5,22 @@ export mgwdir=`dirname $0` jhsourcedir=$mgwbuilddir/source jhbuilddir=$mgwbuilddir/build -destdir=src-$mgwconfig +destdir=medit-deps-dbg-src-$mgwconfig-`date +%Y%m%d` do_or_die() { echo "$@" "$@" || exit 1 } -cd $mgwbuildroot +do_or_die mkdir -p $mgwbuildroot/dist-$mgwconfig +cd $mgwbuildroot/dist-$mgwconfig -if [ -e $destdir ]; then - echo "Directory $destdir already exists" - exit 1 -fi +do_or_die rm -fr $destdir.zip $destdir +do_or_die mkdir -p $destdir +do_or_die cp -lfR $jhsourcedir/* $destdir/ +do_or_die cp -lfR $jhbuilddir/* $destdir/ -do_or_die mkdir src-$mgwconfig -do_or_die cp -lfR $jhsourcedir/* src-$mgwconfig/ -do_or_die cp -lfR $jhbuilddir/* src-$mgwconfig/ - -cd src-$mgwconfig +cd $destdir { find . -type d \( -name 'tests' \) -print0 | xargs -0 rm -r ; } || exit 1 { find . -type d \( -name '.libs' -o -name '.deps' \) -print0 | xargs -0 rm -r ; } || exit 1 @@ -82,5 +79,6 @@ find . -type f \( \ -name '*.lai' \ \) -delete || exit 1 -cd $mgwbuildroot -do_or_die zip -r src-$mgwconfig.zip src-$mgwconfig +cd $mgwbuildroot/dist-$mgwconfig +do_or_die zip -r9 $destdir.zip $destdir +do_or_die rm -rf $destdir diff --git a/plat/win32/gtk-win/copyuser.sh b/plat/win32/gtk-win/copyuser.sh index 90c79a02..408d93b6 100755 --- a/plat/win32/gtk-win/copyuser.sh +++ b/plat/win32/gtk-win/copyuser.sh @@ -113,8 +113,14 @@ gtk20 ' copy_files_from_dir() { + op=$1 + shift subdir=$1 shift + copy_cmd="cp -f" + if [ "$op" = "link" ]; then + copy_cmd="$copy_cmd -l" + fi cd $srcdir/$subdir || exit 1 for f in $@; do subsubdir=`dirname $f` @@ -126,17 +132,17 @@ copy_files_from_dir() { mkdir -p "$dstsubdir" || exit 1 fi echo " -- $dstsubdir/`basename $f`" - cp -fl $f "$dstsubdir/" || exit 1 + $copy_cmd $f "$dstsubdir/" || exit 1 done } copy_files() { - copy_files_from_dir bin $bin_files - copy_files_from_dir bin $old_grep_bin_files -# copy_files_from_dir bin $new_grep_bin_files - copy_files_from_dir etc $etc_files - copy_files_from_dir lib $lib_files - copy_files_from_dir share $share_files + copy_files_from_dir copy bin $bin_files + copy_files_from_dir copy bin $old_grep_bin_files +# copy_files_from_dir link bin $new_grep_bin_files + copy_files_from_dir link etc $etc_files + copy_files_from_dir link lib $lib_files + copy_files_from_dir link share $share_files } copy_locale() { @@ -208,4 +214,11 @@ fi copy_icons copy_mime +tarball=medit-bdist-$mgwconfig-`date +%Y%m%d`.zip +cd `dirname $dstdir` +do_or_die rm -f $mgwdistdir/$tarball +do_or_die zip -r9 $tarball.tmp `basename $dstdir` +do_or_die mkdir -p $mgwdistdir +do_or_die mv $tarball.tmp $mgwdistdir/$tarball + # -%- indent-width:2 -%- diff --git a/plat/win32/gtk-win/jhbuildrc/jhbuildrc b/plat/win32/gtk-win/jhbuildrc/jhbuildrc index 9ef013c0..1acc1632 100644 --- a/plat/win32/gtk-win/jhbuildrc/jhbuildrc +++ b/plat/win32/gtk-win/jhbuildrc/jhbuildrc @@ -9,7 +9,7 @@ if _gtkwinconfig is None: _gtkwinconfig = 'release' else: _gtkwinconfig = _gtkwinconfig.lower() -assert _gtkwinconfig in ['debug', 'release'] +assert _gtkwinconfig in ['debug', 'reldbg', 'release'] _mingw_tool_prefix = None for __p in ('i686-pc-mingw32', 'i586-mingw32msvc', 'i486-mingw32'): @@ -62,8 +62,10 @@ for _var in _mingw_tools: if _gtkwinconfig == 'debug': _def_cflags = '-gstabs' -else: +elif _gtkwinconfig == 'reldbg': _def_cflags = '-gstabs -O2' +else: + _def_cflags = '-O2' # os.environ['LDFLAGS'] = "-L%s/lib" % (prefix,) # os.environ['CPPFLAGS'] = "-I%s/include" % (prefix,) diff --git a/plat/win32/gtk-win/make.sh b/plat/win32/gtk-win/make.sh index 2da7d390..0d01d2db 100755 --- a/plat/win32/gtk-win/make.sh +++ b/plat/win32/gtk-win/make.sh @@ -1,7 +1,7 @@ #! /bin/sh if [ "$1" = "--help" -o "$1" = "-h" ]; then - echo "Usage: $0 [--debug|--release|--all] " + echo "Usage: $0 [--debug|--release|--reldbg|--all] " exit 0 fi @@ -11,6 +11,8 @@ if [ "$1" = "--all" ]; then $0 --debug "$@" || exit 1 echo $0 --release "$@" $0 --release "$@" || exit 1 + echo $0 --reldbg "$@" + $0 --reldbg "$@" || exit 1 exit 0 fi diff --git a/plat/win32/mingw-configure b/plat/win32/mingw-configure index 41630748..f9685192 100755 --- a/plat/win32/mingw-configure +++ b/plat/win32/mingw-configure @@ -34,11 +34,16 @@ if $en_only; then destdir=$destdir-en fi -if [ "$mgwconfig" = "debug" ]; then - _def_cflags='-gstabs' -else - _def_cflags='-O2' -fi +case "$mgwconfig" in + debug) : + _def_cflags='-gstabs' ;; + reldbg) : + _def_cflags='-gstabs -O2' ;; + release) : + _def_cflags='-O2' ;; + *) : + echo "oops"; exit 1 ;; +esac export ADDR2LINE=$_mingw_tool_prefix-addr2line export AS=$_mingw_tool_prefix-as