• How to pass build arguments when try to build multi dir?

    From Bo YU@21:1/5 to All on Wed Apr 5 08:20:01 2023
    Hi mentor!

    I am now in the process of packaging a package, but there are some
    unknown issues for me.:(

    The upstream project is here: https://gitee.com/wine-ce/wine-ce.

    The project needs extra two vendor modules to work. From 'Build From
    Source' section, we can see:
    ```
    cd wine
    i386_CC="clang -fuse-ld=lld --target=i686-pc-windows" \
    x86_64_CC="clang -fuse-ld=lld --target=x86_64-pc-windows" \ x86_64_UNIX_CC="clang -fuse-ld=lld --target=x86_64-pc-linux --sysroot=/usr/x86_64-linux-gnu/
    -L/usr/lib/gcc-cross/x86_64-linux-gnu/12/" \
    aarch64_CC="clang -fuse-ld=lld --target=aarch64-pc-windows" \ aarch64_UNIX_CC="clang -fuse-ld=lld --target=aarch64-pc-linux --sysroot=/usr/aarch64-linux-gnu/
    -L/usr/lib/gcc-cross/aarch64-linux-gnu/12/" \
    ./configure --prefix=/opt/wine-ce --disable-tests --enable-archs=i386,x86_64,aarch64

    make -j6
    sudo make install

    cd ..
    ```
    And
    ```
    mkdir build.qemu
    cd build.qemu

    CC=gcc CC_FOR_BUILD="$CC" CXX="$CC" HOST_CC="$CC" LDFLAGS="-Wl,-Ttext-segment=0x100000000 -Wl,-z,max-page-size=0x1000 -Wl,-Bstatic,-lglib-2.0 -Wl,-Bdynamic" ../qemu/configure --without-default-features --disable-fdt --disable-system
    --enable-ca11c0de --disable-rcu --meson=meson --target-list=x86_64-linux-user,aarch64-linux-user

    ninja -j6
    cd ..
    ```
    This is a multi build system and need to configure it before build.
    There is my d/rules:
    ```
    #!/usr/bin/make -f
    export DH_VERBOSE = 1
    export DEB_BUILD_MAINT_OPTIONS=hardening=+all

    DEB_WINE_DIR=$(CURDIR)/debian/wine-ce/usr DEB_QEMU_DIR=$(CURDIR)/debian/build_qemu
    PE_ARCHES="i386 aarch64 x86_64"

    CONFIG_PRE=i386_CC="clang -fuse-ld=lld --target=i686-pc-windows" \
    aarch64_CC="clang -fuse-ld=lld --target=aarch64-pc-windows" \
    aarch64_UNIX_CC="clang -fuse-ld=lld
    --target=aarch64-pc-linux --sysroot=/usr/aarch64-linux-gnu/ -L/usr/lib/gcc-cross/aarch64-linux-gnu/12/" \
    x86_64_CC="clang -fuse-ld=lld --target=x86_64-pc-windows" \
    x86_64_UNIX_CC="clang -fuse-ld=lld --target=x86_64-pc-linux --sysroot=/usr/x86_64-linux-gnu/
    -L/usr/lib/gcc-cross/x86_64-linux-gnu/12/"


    %:
    dh $@
    override_dh_autoreconf:

    override_dh_auto_configure:
    cd $(CURDIR)/wine && echo $(CONFIG_PRE) && ./configure --prefix="$(DEB_WINE_DIR)" --disable-tests --enable-archs=$(PE_ARCHES)

    override_dh_auto_build:
    cd $(CURDIR)/wine && $(MAKE) -j$(shell nproc)
    mkdir -p $(DEB_QEMU_DIR) && cd $(DEB_QEMU_DIR) && CC=gcc CC_FOR_BUILD="$CC" CXX="$CC" HOST_CC="$CC" \
    LDFLAGS="-Wl,-Ttext-segment=0x100000000 \
    -Wl,-z,max-page-size=0x1000 -Wl,-Bstatic,-lglib-2.0 -Wl,-Bdynamic" $(CURDIR)/qemu/configure --without-default-features \
    --disable-fdt --disable-system --enable-ca11c0de
    --disable-rcu --meson=meson \
    --target-list=x86_64-linux-user,aarch64-linux-user &&
    ninja -j$(shell nproc)

    override_dh_auto_install:
    cd $(CURDIR)/wine && $(MAKE) install

    execute_after_dh_install:
    strip $(DEB_QEMU_DIR)/qemu-x86_64 -o $(DEB_WINE_DIR)/bin/qemu-x86_64
    strip $(DEB_QEMU_DIR)/qemu-aarch64 -o $(DEB_WINE_DIR)/bin/qemu-aarch64
    cd $(CURDIR) && chmod +x generate_scripts.sh &&
    ./generate_scripts.sh $(DEB_WINE_DIR)/bin/

    override_dh_makeshlibs:
    # avoid unnecessary calls to ldconfig
    dh_makeshlibs -n

    override_dh_auto_clean:
    rm -rf $(DEB_QEMU_DIR)
    rm -rf $(DEB_WINE_DIR)
    ```
    The package can be built with the d/rules but is somewhat incorrect.
    The problem is with `override_dh_auto_configure`.
    In upstream, compiler options and the `configure` command are one
    part, it works by hand to configure it simulated.
    But aarch64_CC and aarch64_UNIX_CC cannot be recognized by the build
    system of wine.

    I know the d/rules is very terrible and this needs to be improved but
    it should it works I think.
    Any help will be appreciated.

    BR,
    Bo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)