On 07/09/2011 07:43 PM, Erik van Pienbroek wrote:
> Farkas Levente schreef op wo 06-07-2011 om 23:51 [+0200]:
>> i can't solve this f***n debug define so it's always have to add to the
>> spec file:
>> ----------------------------
>> %define __debug_install_post %{mingw_debug_install_post}
>> ----------------------------
> 
> Does it work if you hide this line behind the mingwtool macro (so that
> this line gets added by the mingwtool) ? 

no but you can image how hard i try to do so!
but still trying.

> As it is now, I see a major issue with this approach. That is that the
> mingwtool isn't part of a default Fedora/EPEL buildroot. So if you try
> to build such a package in mock/koji it will fail because it doesn't
> know where to find the mingwtool. Even if you add a BR: mingw-filesystem
> (or wherever the mingwtool will be bundled with) then the build will
> still fail because mock/koji only processes the BuildRequires tags
> once. 

no. it'll be added to mingw-filesystem-base and kojo can use it. just
try it:-)
of course the
BuildRequires: mingw-filesystem-base can't be added by the mingwtool but
by hand (which is missing in my example:-(

> There are two solutions to this problem. Unfortunately each one comes
> with its own set of drawbacks
> (1). Have the package containing the mingwtool become part of the
> default Fedora/EPEL buildroot
> (2). Bundle the mingwtool with every package which needs the mingwtool
> to build

epel used to bundle kmodtool with each package but that's what i hate
most. even redhat-rpm-config contains an almost good kmodtool it's not
perfect and unfortunately i can't convince jon master before 6.0 to fix
those problem and after the release it real hard to push anything into rhel.

> The kmodtool seems to be part of the package redhat-rpm-config which is
> in the default buildroot. That's why building kernel modules work fine
> in mock/koji.

but don't use it (we've got an internal updated redhat-rpm-config and
all kmod use it).

> This sure looks interesting. You may want to split the expand
> instruction over multiple lines so that it's better readable.

it can be splited (i test it).

> Did you also take care of the situation that not all mingw-* packages
> are also available on darwinx-* ? For example, the package win-iconv is
> only available for Win32 and Win64. Perhaps you could create some kind
> of exception-list inside the mingwtool which contains a list of all such
> special-case packages.

i don't know about it so don't think about it. may be in the next
version, but in this case it'd be better to br iconv which is provided
by win-iconv on mingw* and something else on darwinx.

> Could you also send the mingwtool script to this mailing list once your
> okay with it so we can take a look at it?

ops i forget to attach the most important script:-)
i'll add a few small modification you suggest and checkin everything
into the svn with the new libogg spec file as the example.

-- 
  Levente                               "Si vis pacem para bellum!"
#!/bin/bash

# mingwtool - Helper script for building mingw RPMs
# Copyright (c) 2011 Levente Farkas <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

mingw32=1
mingw64=1
darwinx=0
static=1
debug=1
mytargets=""
br="filesystem binutils"
req=""
prov=""
obs=""
doc=""

print_tag() {
        tag=$1
        shift
        for target in $mytargets; do
                for i in "$@"; do
                        echo "$tag: $target-$i"
                done
        done
}

print_variables() {
        local param name old
        while [ "$1" != "${1##[-+]}" ]; do
                case "$1" in
                        --enable-*|--with-*)
                                param=`sed "s/--.*-//"<<<"$1"`
                                eval declare \$param=1
                                ;;
                        --disable-*|--without-*)
                                param=`sed "s/--.*-//"<<<"$1"`
                                eval declare \$param=0
                                ;;
                        --br=*|--req=*|--prov=*|--obs=*|--doc=*)
                                name=`sed "s/^--\(.*\)=.*/\1/"<<<"$1"`
                                param=`sed "s/--$name=//; s/\"//g"<<<"$1"`
                                eval old=\$$name
                                declare $name="$old $param"
                                ;;
                        --br|--req|--prov|--obs|--doc)
                                name=`sed "s/^--//"<<<"$1"`
                                param="$2"
                                eval old=\$$name
                                declare $name="$old $param"
                                ;;
                        *)
                                usage >&2
                                exit 1
                                ;;
                esac
                shift
        done
        for target in mingw32 mingw64 darwinx; do
                if eval [ \$$target == 1 ]; then
                        echo "%global mingw_build_$target 1"
                        # for backward compatibility only
                        [[ $target =~ mingw.* ]] &&
                                echo "%global mingw_build_`sed 
's/mingw/win/'<<<$target` 1"
                        mytargets+=" $target"
                fi
        done
        echo "%global mingw_build_targets $mytargets"
        [ $static == 1 ] && echo "%global mingw_build_static 1"
        [ $debug  == 1 ] && echo "%global mingw_build_debug  1"
        #[ $debug  == 1 ] && echo "%global mingw_build_debug  1" && echo 
"%define __debug_install_post /home/lfarkas/rpm/SOURCES/mingw-find-debuginfo.sh 
%{_builddir}/%{?buildsubdir} %{mingw_build_targets}"
        [ -n "$doc" ] && echo "%global ${target}_docfiles $doc"
        [ -n "$br" ] && print_tag BuildRequires $br
}

print_header() {
        print_variables "$@"
        cat <<-EOF
        BuildRequires: mingw-filesystem
        BuildArch: noarch

        %{?rhel:
        BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} 
-n)

        %global _use_internal_dependency_generator 0
        %global __find_requires %{mingw_findrequires}
        %global __find_provides %{mingw_findprovides}}
        %{nil}

        %global __strip %{mingw_strip}
        %global __objdump %{mingw_objdump}

        EOF
        print_subpkg
}

print_subpkg() {
        for target in $mytargets; do
                cat <<-EOF
                %${target}_package
                %${target}_static_package
                %${target}_debug_package
                EOF
        done
}

usage()
{
        cat <<-EOF
                You called: ${invocation}

                Usage: ${myprog} <command> <option>+
                Commands:
                  header
                    - Add MinGW Header setion
                  version  
                    - Output version number and exit.
        EOF
}

invocation="$(basename ${0}) $@"
while [ "${1}" ] ; do
        case "${1}" in
                header)
                        shift
                        print_header "$@"
                        exit $?
                        ;;
                *)
                        echo "Error: Unknown option '${1}'." >&2
                        usage >&2
                        exit 2
                        ;;
        esac
done

_______________________________________________
mingw mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/mingw

Reply via email to