Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NOTE: DRAFT / WORK-IN-PROGRESS / INCOMPLETE

...

  • Extract it with:
    tar xvf libusb-mingw-w64_1.0.24.orig.tar.gz

  • Rename extracted folder name to match “<source-package-name>-<upstream-version-number>”:
    mv libusb-1.0.24 libusb-mingw-w64-1.0.24

...

  • cd libusb-mingw-w64-1.0.24

  • Copy the debian/rules file from libz into libusb:

    Code Block
    languagem
    mkdir debian
    cp ../libz-mingw-w64-1.2.11+dfsg/debian/rules debian/

    • NOTE: This turned out to be a bad idea, since libz compiles very differently to libusb. In the end, I think it was better to borrow the build logic from a libpng-mingw package instead, which was closer.

      https://launchpad.net/~tobydox/+archive/ubuntu/mingw-w64/+sourcefiles/libpng-mingw-w64/1.6.37-2.1/libpng-mingw-w64_1.6.37-2.1.diff.gz

      I borrowed the logic inside the diff.gz file’s diff output for the debian/rules file and copied it to my libusb instead… It still needed several tweaks after this:

      • Edit the debian/rules file and remove any mention of --disable-static in it.

      • Search for any references to ‘libpng’ within the file and aim to replace them with ‘libusb’

        • Some of these tweaks might relate to the upstream tar file, so assess if the filename matches what you have. If not, tweak the reference in this file to make it match what you have.

  • Create an initial changelog file with:
    dch --create -v1.0.24-1 --package libusb-mingw-w64

    • You’ll need to pick you’re favourite editor from a list and then edit the default contents.

    • Be sure to replace the default email address with your own valid one (otherwise there will be build errors later)

    • Save the file and exit your editor

  • Copy across the debian/compat file:
    cp ../libz-mingw-w64-1.2.11+dfsg/debian/compat debian/

  • Copy across the debian/copyright file:
    cp ../libz-mingw-w64-1.2.11+dfsg/debian/copyright debian/

  • Copy across the debian/control file:
    cp ../libz-mingw-w64-1.2.11+dfsg/debian/control debian/

    • It contains descriptions for one source and two packages.

    • Try update these details to suit ‘libusb’, put your own name as maintainer.

    • You can remove those Vcs-Browser/Vcs-Git/Homepage lines if you can’t be bothered chasing up those details.

    • Search for the term ‘libz’ and sure any past references to it are now saying ‘libusb’

  • Copy across the debian/source/format file:

    Code Block
    languagem
    mkdir debian/source
    cp ../libz-mingw-w64-1.2.11+dfsg/debian/source/format debian/source/

...

  • Let's try building with:

    debuild -us -uc

  • Google around for any issues that arise on each build attempt…
    Edit the debian/rules file and add the following stuff in green:
    CFLAGS="$(CFLAGS) -Os" CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ dh_auto_configure --builddirectory build-udeb -- --libdir=\$${prefix}/lib/
    Run debuild -us -uc and make note of any errors spotted there. E.g. for me:
    dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 12.4) libudev-dev doxygen
    In this case, I just needed to install a few dependencies:
    sudo apt install debhelper libudev-dev doxygen
    If you get an error like this:
    /usr/bin/x86_64-w64-mingw32-ld: unrecognized option '-z'

    Edit the following files and remove and reference to -Wl,-z,relro

  • build-deb/Makefile

  • build-deb/tests/Makefile

  • build-deb/libusb/Makefile

  • build-deb/examples/Makefile

  • build-deb/doc/Makefile
  • Try open the generated .deb file in an archive browser to assess whether the built binaries are in the desired locations

  • Try install the package and build a mega65-tools mingw target, e.g. make bin/mega65_ftp.exe and see if you get any errors

  • If you get errors, uninstall the .deb, tweak your debian/* files some more, google some more, try call debuild -us -uc again, try install binaries and run the make .exe again. Rinse and repeat…