Upgrade to Pro — share decks privately, control downloads, hide ads and more …

qmakeなQtアプリのdebを作ろうとして試行錯誤した話

 qmakeなQtアプリのdebを作ろうとして試行錯誤した話

第 120 回関西 Debian 勉強会で発表した、前年のパッケージング道場を受けてから、tomightyという、ポモドーロテクニック用のアプリのdebを作ろうとした話です。

Katsuki Kobayashi

February 26, 2017
Tweet

More Decks by Katsuki Kobayashi

Other Decks in Programming

Transcript

  1. qmake ͳ Qt ΞϓϦͷ deb Λ ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ - ୈ 120

    ճ ؔ੢ Debian ษڧձ ൃදࢿྉ - 2017 ೥ 2 ݄ 26 ೔ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 1 / 47
  2. ຊ೔࿩ͦ͏ͱࢥͬͯΔ΋ͷ ▶ ࣗݾ঺հ • ࢲͷ Debian ྺ ▶ tomighty ˡ

    ࠓճύοέʔδԽͨ͠ΞϓϦ • ϙϞυʔϩ ςΫχοΫ • qmake ▶ deb Խ • CDBS or dh • gbp • Travis CI (travis.debian.net) খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 2 / 47
  3. ຊ೔࿩ͦ͏ͱࢥͬͯΔ΋ͷ ▶ ࣗݾ঺հ • ࢲͷ Debian ྺ ▶ tomighty ˡ

    ࠓճύοέʔδԽͨ͠ΞϓϦ • ϙϞυʔϩ ςΫχοΫ • qmake ▶ deb Խ • CDBS or dh • gbp • Travis CI (travis.debian.net) ίϝϯτ౳ɺద͓ٓئ͍͠·͢ ࣌ؒ΋ͨͤΔࣗ৴ͳ͍ & ৲͢΅Έ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 2 / 47
  4. ࣗݾ঺հ (1/5) ໊લ খྛ ࠀر (Katsuki Kobayashi) Twitter @rarewin ࢓ࣄ

    ૊ΈࠐΈ (σδΧϝͷ FW) ▶ C ݴޠ ▶ ARM ͷΞηϯϒϥ ▶ Windows όονϑΝΠϧͱ͔ “SHELL=CMD.EXE” ͱ͔ͨ͠ Makefileʜʜ ͦͷଞ ઌʑिͷ BSP Ͱ Debian BTS ʹॳ౤ߘ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 3 / 47
  5. ࣗݾ঺հ (1/5) ໊લ খྛ ࠀر (Katsuki Kobayashi) Twitter @rarewin ࢓ࣄ

    ૊ΈࠐΈ (σδΧϝͷ FW) ▶ C ݴޠ ▶ ARM ͷΞηϯϒϥ ▶ Windows όονϑΝΠϧͱ͔ “SHELL=CMD.EXE” ͱ͔ͨ͠ Makefileʜʜ ͦͷଞ ઌʑिͷ BSP Ͱ Debian BTS ʹॳ౤ߘ ࠶དྷिɺ਌ෆ஌Λൈࣃ͢Δ͜ͱʹͳͬͯϒϧʔͳͷͰ ΍͍ͯͩ͘͘͞͠͠͞ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 3 / 47
  6. ࣗݾ঺հ (2/5) ▶ AS(Ξγελϯτελοϑ) ͱ͍͏ಾͷूஂ @ େֶ • gtach ͞Μ

    (DD) • takaki ͞Μ (DD) • sugi ͞Μ (DM) • Wanderlust ։ൃऀͷҰਓ • plum, madoka ։ൃऀ (IRC ޷͖͗͢!?) • ࢲͷಉظͷ༑ਓ ˡ ࢲΑΓઌʹࡏ੶ɺͦͯ͠ઌʹൈ͚ͨʜʜ • ౳ʑ ▶ ࢲ͕ೖͬͨͱ͖͸ɺ΄ͱΜͲͷํ͸ଔۀͨ͠ޙͰͨ͠ • Θ͟Θ͟େֶʹ͍ͳͯ͘΋ ϒϩʔυόϯυ͕Ոఉ·ͰདྷΔΑ͏ʹͳ͔ͬͨΒ͔ͳʜʜ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 4 / 47
  7. ࣗݾ঺հ (3/5) ▶ Debian • AS ͷઌഐ or ಉظͷ༑ਓͷ෍ڭʹΑΓ࢖༻։࢝ −

    पΓ͸ Vine Linux ͱ͔ Turbo Linux ͱ͔ RedHat ͩͱ͔ − APT ສࡀ • ࠷ॳ͸ Potato − ๕ඌ͞Μ ʰࠓ೔͔Β Debian GNU/Linux 2.2 (ඈͼࠐΈຊ)ʱ − ಺ଂϞσϜ࢖͑ͳ͍ − X ͕͕͋Βͳ͍ (i810 νοϓηοτͷυϥΠόʜʜ) − Ի͕ग़ͳ͍ (ALSA ͬͯͳʹʜʜ?) • ؾ෇͚͹ sid ΛೖΕ͍ͯͨ • େֶଔۀޙ͸શવ͞ΘΒͣʜʜ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 5 / 47
  8. ࣗݾ঺հ (4/5) ▶ deb ύοέʔδ • ֶੜͷͱ͖ʹ͍͔ͭ͘໺ྑύοέʔδΛͭͬͯ͘ެ։ − danpei: GTK

    ͳը૾αϜωΠϧϏϡʔϫ − wakkabox: SDL Ͱॻ͔ΕͨήʔϜ − etc... • Ұ࣌ظ Ubuntu ʹऔΓࠐ·Ε͍ͯͨʜʜ − http://old-releases.ubuntu.com/ubuntu/pool/universe/d/ danpei/?C=S;O=A − http://old-releases.ubuntu.com/ubuntu/pool/universe/w/ wakkabox/?C=S;O=A খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 6 / 47
  9. ࣗݾ঺հ (5/5) % dpkg -I wakkabox_1.1.0-1_i386.deb ৽ܗࣜ debian ύοέʔδɺόʔδϣϯ 2.0ɻ

    αΠζ 80004 όΠτ: ίϯτϩʔϧΞʔΧΠϒ = 1034 όΠτɻ 26 όΠτɺ 1 ߦ conffiles 364 όΠτɺ 10 ߦ control 854 όΠτɺ 13 ߦ md5sums 185 όΠτɺ 7 ߦ * postinst #!/bin/sh 160 όΠτɺ 5 ߦ * postrm #!/bin/sh Package: wakkabox Version: 1.1.0-1 Section: games Priority: optional Architecture: i386 Depends: libc6 (>= 2.3.4-1), libsdl1.2debian (>> 1.2.7+1.2.8) Installed-Size: 240 Maintainer: Katsuki Kobayashi <[email protected]> Description: An amusing block shuffling puzzle game Wakkabox is an amusing block shuffling puzzle game written in C using SDL. খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 7 / 47
  10. tomighty ▶ ࠓճ deb Λ࡞੒ͯ͠Έͨπʔϧ • Qt ΞϓϦ − λεΫόʔʹৗற͢ΔλΠϓ

    − qmake(ޙड़) Λ͔ͭ͏ • ϙϞυʔϩɾςΫχοΫ (ޙड़) ༻ͷπʔϧ • http://tomighty.org/ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 8 / 47
  11. ϙϞυʔϩɾςΫχοΫ ▶ Francesco Cirillo ͞Μ͕ߟҊͨ࣌ؒ͠؅ཧͷςΫχοΫ • http://cirillocompany.de/pages/pomodoro-technique/ ▶ खॱ 1.

    ׬͍ྃͤͨ͞λεΫΛબ୒ͯ͠ࢴʹॻ͖ग़͢ 2. ϙϞυʔϩ (λΠϚʔ) Λ 25 ෼ʹηοτ͢Δ 3. λΠϚ͕໐Δ·Ͱूத͢Δ (΍Δࣄม͑Δͷ͸ OK) 4. λΠϚ͕໐ͬͨΒࢴʹνΣοΫΛೖΕΔ − ໐Δલʹதஅͨ͠Βɺ(ͨͿΜ)1 ʹ໭Δ 5. short-break(5 ෼ఔ౓?) ΛऔΔ 6. 4 ճϙϞυʔϩΛ׬͍ྃͯͨ͠Β long-break(20ʙ30 ෼?) ΛऔΔ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 9 / 47
  12. ͳΜͰϙϞυʔϩ? ▶ Rebuild.fm ͱ͍͏ϙουΩϟετͰ঺հ͞Ε͍ͯͨ • Episodo 139: https://rebuild.fm/ • Perl

    ϋοΧʔ (Plugger ࡞ऀ) ͷٶ઒ୡ඙͞Μ͕ϗετ • higepon ͞Μ͕঺հ − ٶ઒͞Μ΋΍͍ͬͯͨ − ͕ɺ࠷৽Τϐιʔυ (Ep.175) Ͱ͸ʮ΍Βͳ͘ͳͬͨʯͱʜʜ ▶ ʮ25 ෼ʯͱ͍͏௕͕͞ΘΓͱΑ͍ • ௕͗ͣ͢ɺ୹͔͗ͣ͢ • ٳܜΛڧ੍తʹೖΕΔͷ΋ྑ͛͞ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 10 / 47
  13. tomighty ࣮ԋʜʜ ▶ ͋Ε? ͳΜ͔͠ΐ΅͘ͳ͍? • ࣮͸ɺݩʑ Java Ͱॻ͔Ε͍ͯͨͷΛ Qt

    Ͱॻ͖௚͍ͯ͠Δ • ձ͕ࣾ Windows ؀ڥͳͷͰ Java ൛Λ࢖͍ͬͯͨ • ݁ߏΑ͔ͬͨͷͰ Qt ൛΋͍͍ײ͡ͷ͸ͣ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 12 / 47
  14. tomighty ࣮ԋʜʜ ▶ ͋Ε? ͳΜ͔͠ΐ΅͘ͳ͍? • ࣮͸ɺݩʑ Java Ͱॻ͔Ε͍ͯͨͷΛ Qt

    Ͱॻ͖௚͍ͯ͠Δ • ձ͕ࣾ Windows ؀ڥͳͷͰ Java ൛Λ࢖͍ͬͯͨ • ݁ߏΑ͔ͬͨͷͰ Qt ൛΋͍͍ײ͡ͷ͸ͣ ͱࢥ͍ͬͯͨ࣌ظ͕๻ʹ΋͋Γ·ͨ͠ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 12 / 47
  15. ࢒೦ͳ͓஌Βͤ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ

    deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 13 / 47
  16. ࢒೦ͳ͓஌Βͤ ▶ Qt ͸ࣺͯΒΕɺ.NET ͱ Objective-C ʹͳ͍ͬͯͨʜʜɻ ▶ “fork me

    on GitHub” ͷϦϯΫ͸͜͜ʹͳͬͯΔͷʹ!! ▶ ͱΓ͋͑ͣ͜ͷ··ਐΊ·͢ʜʜɻ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 13 / 47
  17. qmake Λ͍ͬͯ͡ΈΔ (1/7) ▶ qmake: http://doc.qt.io/qt-5/qmake-manual.html The qmake tool helps

    simplify the build process for development projects across different platforms. It automates the generation of Makefiles so that only a few lines of information are needed to create each Makefile. You can use qmake for any software project, whether it is written with Qt or not. • cmake ͱൺֱ͞ΕΔ͜ͱ͕͓͓ͦ͏? খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 14 / 47
  18. qmake Λ͍ͬͯ͡ΈΔ (2/7) ▶ ͓΋ΉΖʹ qmake ͷόʔδϣϯΛݟͯΈ·͠ΐ͏ % qmake --version

    খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 15 / 47
  19. qmake Λ͍ͬͯ͡ΈΔ (2/7) ▶ ͓΋ΉΖʹ qmake ͷόʔδϣϯΛݟͯΈ·͠ΐ͏ % qmake --version

    QMake version 3.0 Using Qt version 5.7.1 in /usr/lib/x86_64-linux-gnu ▶ Qt5 ͷ qmake ͕ݺ͹Ε͍ͯΔ • ਓʹΑͬͯ͸ Qt4 ͷํ͕ݺ͹ΕΔͱࢥ͍·͢ • qtX-defaultύοέʔδ (ೖͬͯͳ͍ͱΤϥʔ) খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 15 / 47
  20. qmake Λ͍ͬͯ͡ΈΔ (2/7) ▶ ͓΋ΉΖʹ qmake ͷόʔδϣϯΛݟͯΈ·͠ΐ͏ % qmake --version

    QMake version 3.0 Using Qt version 5.7.1 in /usr/lib/x86_64-linux-gnu ▶ Qt5 ͷ qmake ͕ݺ͹Ε͍ͯΔ • ਓʹΑͬͯ͸ Qt4 ͷํ͕ݺ͹ΕΔͱࢥ͍·͢ • qtX-defaultύοέʔδ (ೖͬͯͳ͍ͱΤϥʔ) ˡ͞ΒΓͱॻ͍ͯΔ͚ͲޙͰࠅ͍໨ʹ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 15 / 47
  21. qmake Λ͍ͬͯ͡ΈΔ (3/7) ▶ -qt ΦϓγϣϯΛ࢖ͬͯ Qt4 Λಈ͔ͯ͠ΈΔ % qmake

    -qt=qt4 --version খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 16 / 47
  22. qmake Λ͍ͬͯ͡ΈΔ (3/7) ▶ -qt ΦϓγϣϯΛ࢖ͬͯ Qt4 Λಈ͔ͯ͠ΈΔ % qmake

    -qt=qt4 --version QMake version 2.01a Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu ▶ Qt4 ͷ qmake ͕ݺ͹ΕΔΑ͏ʹͳͬͨ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 16 / 47
  23. qmake Λ͍ͬͯ͡ΈΔ (4/7) ▶ ؀ڥม਺ QT_SELECT Λ࢖ͬͯ Qt4 Ͱಈ͔ͯ͠ΈΔ %

    QT_SELECT=qt4 qmake --version খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 17 / 47
  24. qmake Λ͍ͬͯ͡ΈΔ (4/7) ▶ ؀ڥม਺ QT_SELECT Λ࢖ͬͯ Qt4 Ͱಈ͔ͯ͠ΈΔ %

    QT_SELECT=qt4 qmake --version QMake version 2.01a Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu ▶ Qt4 ͷ qmake ͕ݺ͹ΕΔΑ͏ʹͳͬͨ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 17 / 47
  25. qmake Λ͍ͬͯ͡ΈΔ (5/7) ▶ ࢓૊Έ • upstream ͕ఏڙ͍ͯ͠Δ qtchooser ʹΑͬͯ੾Γ׵Θ͍ͬͯΔ

    % ls -l /usr/bin | grep qtchooser ... lrwxrwxrwx 1 root root 9 11 ݄ 11 00:29 qlalr -> qtchooser* lrwxrwxrwx 1 root root 9 11 ݄ 11 00:29 qmake -> qtchooser* lrwxrwxrwx 1 root root 9 11 ݄ 11 00:29 qml -> qtchooser* ... -rwxr-xr-x 1 root root 43728 11 ݄ 11 00:29 qtchooser* খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 18 / 47
  26. qmake Λ͍ͬͯ͡ΈΔ (6/7) ▶ Debian KDE Team https://pkg-kde.alioth.debian.org/packagingqtbasedstuff.html The selection

    method is based on qtchooser. Take a look at it’s man page for full details, but basically boils down to: • Exporting QT_SELECT with 4, qt4, 5 or qt5 as value in debian/rules. • Call the tool using the ’-qtx’ parameter, where x can be replaced with any of the options above. We have also provided qt4-[arch-triplet] and qt5-[arch-triplet] options for special cases, in case you might need them. Beware this should not be used to build packages for the Debian archive. খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 19 / 47
  27. qmake Λ͍ͬͯ͡ΈΔ (7/7) ▶ qmake ʹ৯΂ͤ͞Δ.pro ϑΝΠϧ • qtcreator Ͱ࡞੒ͯ͘͠ΕΔ

    • qtcreator - Integrated Development Environment for Qt খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 20 / 47
  28. tomighty ͷ৔߹ (1/4) ▶ tomighty ΋ಉ༷ʹ Ϗϧυ༻ͷσΟϨΫτϦΛ࡞੒ͯ͠ qmake Λ૸ΒͤΔ %

    cd (tomighty ͷιʔεπϦʔ) % mkdir build % cd build % qmake -qt=qt5 ../src/tomighty.pro % make খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 22 / 47
  29. tomighty ͷ৔߹ (2/4) ▶ ·͊ɺίέΔΜͰ͚͢ͲͶʜʜ • MSYS2 (on Windows) ͳΒେৎ෉Ͱͨ͠ʜʜɻ

    /tmp/tomighty/build/test-runner/../ui-tests//libtomighty-ui-tests.so: tmty::MockPomodoroEngine::MockPomodoroEngine(QObject*)' ʹର͢Δఆٛ͞Ε͍ͯͳ͍ࢀর /tmp/tomighty/build/test-runner/../core-tests//libtomighty-core-tests.so: tmty::ManualClockwork::ManualClockwork(QObject*)' ʹର͢Δఆٛ͞Ε͍ͯͳ͍ࢀরͰ͢ /tmp/tomighty/build/test-runner/../ui-tests//libtomighty-ui-tests.so: tmty::MockPomodoroEngine::getCurrentIntervalType() const' ʹର͢Δఆٛ͞Ε͍ͯͳ͍ࢀ /tmp/tomighty/build/test-runner/../core-tests//libtomighty-core-tests.so: tmty::ManualClockwork::isRunning() const' ʹର ͢Δఆٛ͞Ε͍ͯͳ͍ࢀরͰ͢ collect2: error: ld returned 1 exit status Makefile:175: λʔήοτ 'tomighty-test-runner' ͷϨγϐͰࣦഊ͠·ͨ͠ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 23 / 47
  30. tomighty ͷ৔߹ (3/4) ▶ ҰԠɺҎԼͷύονͰճආͰ͖Δʜʜ diff --git src/test-runner/test-runner.pro src/test-runner/test-runner.pro index

    44ac2b4..82bc4c8 100644 --- src/test-runner/test-runner.pro +++ src/test-runner/test-runner.pro @@ -29,2 +29,3 @@ win32:CONFIG(release, debug|release): LIBS += \ -L$$OUT_PWD/../core-tests/release/ -ltomighty-core-tests \ + -L$$OUT_PWD/../core-mock/release/ -ltomighty-core-mock \ -L$$OUT_PWD/../ui-tests/release/ -ltomighty-ui-tests @@ -35,2 +36,3 @@ else:win32:CONFIG(debug, debug|release): LIBS += \ -L$$OUT_PWD/../core-tests/debug/ -ltomighty-core-tests \ + -L$$OUT_PWD/../core-mock/debug/ -ltomighty-core-mock \ -L$$OUT_PWD/../ui-tests/debug/ -ltomighty-ui-tests @@ -41,2 +43,3 @@ else:unix: LIBS += \ -L$$OUT_PWD/../core-tests/ -ltomighty-core-tests \ + -L$$OUT_PWD/../core-mock/ -ltomighty-core-mock \ -L$$OUT_PWD/../ui-tests/ -ltomighty-ui-tests খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 24 / 47
  31. tomighty ͷ৔߹ (4/4) ▶ MSYS2 ͩͱେৎ෉ͩͬͨͷ͸ qmake ͕ Windows ͸ผѻ͍Ͱ͖Δ͔ΒͬΆ͍Ͱ͢ɻ

    • ෆໟͳʜʜ % tail -11 src/app/app.pro win32:CONFIG(release, debug|release): LIBS += \ -L$$OUT_PWD/../core/release/ -ltomighty-core \ -L$$OUT_PWD/../ui/release/ -ltomighty-ui else:win32:CONFIG(debug, debug|release): LIBS += \ -L$$OUT_PWD/../core/debug/ -ltomighty-core \ -L$$OUT_PWD/../ui/debug/ -ltomighty-ui else:unix: LIBS += \ -L$$OUT_PWD/../core/ -ltomighty-core \ -L$$OUT_PWD/../ui/ -ltomighty-ui খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 25 / 47
  32. deb ʹͯ͠ΈΔ (1/10) ▶ ͱʹ΋͔͘ʹ΋ tomighty ͷ deb ԽΛਐΊΔ •

    dh_make - prepare Debian packaging for an original source archive ▶ upstream ͕ git ͰλάΛଧͬͯͳ͍৔߹ɺ όʔδϣϯ໊Ͳ͏͢Ε͹ྑ͍ͷͰ͠ΐ͏ʜʜ • ࠓճ͸ "0 (೔෇)-g(git hash)" ͱ͓͖ͯ͠·ͨ͠ % dh_make --createorig -p 'tomighty_0.0.0+git0f673359' -s -c apache --createorig: orig.tar.xz ͷ࡞੒ɺ-p ύοέʔδ໊ɺ -s γϯάϧόΠφϦύοέʔδ (࣮͸ͪΐͬͱӕ) -c ϥΠηϯε (apache ϥΠηϯε) খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 26 / 47
  33. deb ʹͯ͠ΈΔ (2/10) ▶ debian/rules ϑΝΠϧΛΉΓ͘Γॻ͍ͯΈΔ #!/usr/bin/make -f override_dh_auto_configure: mkdir

    build cd build; qmake -qt=qt5 ../src/tomighty.pro override_dh_auto_build: cd build; make override_dh_auto_clean: rm -rf build override_dh_auto_install: cd build; make install INSTALL_ROOT=$(PWD)/debian/tomighty %: dh $@ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 27 / 47
  34. deb ʹͯ͠ΈΔ (3/10) ▶ ৭ʑͱμα͍ • override_* λʔήοτ͹͔Γ • ’cd

    build’ ͹͔ͬΓ • ͦ΋ͦ΋࡞๏తʹͲ͏ͳΜ? খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 28 / 47
  35. deb ʹͯ͠ΈΔ (3/10) ▶ ৭ʑͱμα͍ • override_* λʔήοτ͹͔Γ • ’cd

    build’ ͹͔ͬΓ • ͦ΋ͦ΋࡞๏తʹͲ͏ͳΜ? ▶ debian/rules Λ؆ܿʹ͢ΔͨΊͷબ୒ࢶ • The Common Debian Build System (CDBS) • dh - debhelper ίϚϯυγʔέϯαʔ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 28 / 47
  36. deb ʹͯ͠ΈΔ (4/10) ▶ CDBS ͱ͸ • https://build-common.alioth.debian.org/cdbs-doc.html • debian/rules

    ͷهड़Λ৭ʑͱϞδϡʔϧԽͯ͠࠶ར༻Λૂͬͨ ΋ͷ Switching to CDBS is easy. A simple debian/rules for an autotools-using C or C++ software with no extra rules would be written as this: #!/usr/bin/make -f include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 29 / 47
  37. deb ʹͯ͠ΈΔ (5/10) ▶ CDBS Λ࢖ͬͨ৔߹ QT_SELECT = qt5 DEB_QMAKE_ARGS

    = ../src/tomighty.pro DEB_SRCDIR = $(CURDIR)/src DEB_BUILDDIR = $(CURDIR)/build cleanbuilddir:: -rm -rf $(DEB_DESTDIR) clean:: -rm $(DEB_BUILDDIR)/files -rm $(CURDIR)/debian/tomighty.substvars include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/qmake.mk খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 30 / 47
  38. deb ʹͯ͠ΈΔ (6/10) ▶ CDBS Ͱຬ଍͚ͯͨ͠Ͳ࣮͸ʜʜdh Ͱ΋؆ܿʹͰ͖Δ • /usr/share/perl5/Debian/Debhelper/Buildsystem/qmake.pm •

    override ͯ͠.pro ϑΝΠϧΛҾ਺Ͱ౉͍ͯ͠Δ ίʔυΛݟΔͱιʔεσΟϨΫτϦΛݕࡧͯ͘͠Εͦ͏ͳΜ͚ͩͲʜʜ #!/usr/bin/make -f %: dh $@ --buildsystem=qmake --builddirectory=build \ --sourcedirectory=src override_dh_auto_configure: dh_auto_configure -- $(CURDIR)/src/tomighty.pro খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 31 / 47
  39. deb ʹͯ͠ΈΔ (7/10) ͕͔ͩ͠͠!! খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake

    ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 32 / 47
  40. deb ʹͯ͠ΈΔ (7/10) ͕͔ͩ͠͠!! pbuilder ࢖͏ͱͳ͔ͥ qmake ͕ίέΔΑ͏ʹʜʜ qmake: could

    not find a Qt installation of '' খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 32 / 47
  41. deb ʹͯ͠ΈΔ (8/10) ▶ Ͳ͏΍Βɺqtchooser ͷσϑΥϧτͷόʔδϣϯ͕ ܾ·ͬͯͳ͍ͱग़ΔΤϥʔͳ໛༷ʜʜ • qt{4,5}-default ύοέʔδΛೖΕΔͱσϑΥϧτ͕ܾఆ

    ▶ Qt ͷϝϯςφ: ʮϏϧυͷґଘʹ qt{4,5}-default ΛೖΕͯ͘ΕΔͳʯ • -qt Φϓγϣϯ qtchooser ͷ࠷ॳͷҾ਺ʹ౉͞ͳ͍ͱବ໨ͬΆ͍ • QT_SELECT ؀ڥม਺ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 33 / 47
  42. deb ʹͯ͠ΈΔ (9/10) ▶ CDBS(த਎͸ Makefile) ͩͱ debian/rules Ͱ QMAKE

    ͔ DEB_QMAKE_ARGS Λ͍͍ײ͡ʹ • QT_SEL Λઃఆͯ͋͛ͯ͠΋͏·͍͘͘? common-configure-impl:: $(DEB_BUILDDIR)/Makefile $(DEB_BUILDDIR)/Makefile: $(strip cd $(DEB_BUILDDIR) && \ $(QMAKE) \ $(DEB_QMAKE_ARGS) \ $(if $(DEB_QMAKE_CONFIG_VAL),\ ▶ dh ͩͱʜʜ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 34 / 47
  43. deb ʹͯ͠ΈΔ (10/10) ▶ ͻͱ·ͣͷճආࡦʜʜ • ίϚϯυ͸ qmake ܾΊ͏ͪ •

    Φϓγϣϯ΋࠷ޙʹ௥Ճ͔͠Ͱ͖ͳ͍ -qt ͕ qtchooser ʹ౉ͤͳ͍ #!/usr/bin/make -f %: dh $@ --buildsystem=qmake --builddirectory=build --sourcedirectory=src override_dh_auto_configure: (export QT_SELECT=qt5; dh_auto_configure -- $(CURDIR)/src/tomighty.pro) ▶ ௐ͖ࠪ͠Εͯ·ͤΜ͕ɺͳΜ͔ո͍͠ʜʜɻ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 35 / 47
  44. ൃදޙ௥هεϥΠυ ▶ ҎԼͷΑ͏ʹॻ͘ํ͕៉ྷͳΑ͏Ͱ͢ export ͕ϛιͰ͢ #!/usr/bin/make -f export QT_SELECT=qt5 %:

    dh $@ --buildsystem=qmake --builddirectory=build --sourcedirectory=src override_dh_auto_configure: dh_auto_configure -- $(CURDIR)/src/tomighty.pro খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 36 / 47
  45. gbp Λ࢖ͬͯΈΔ (1/3) ▶ Ҏલ͸ debuild ίϚϯυͰ࣮ߦ͍ͯͨ͠ ▶ upstream ͕

    git Ͱ؅ཧ͞Ε͍ͯΔ • gbp (git-buildpackage) Λ࢖͏ͷ͕Α͍Β͍͠ • ஫: ࠓճ͸͋·Γௐ΂͖Εͯ·ͤΜ ▶ gbp Λ࢖͏ͨΊͷ branch ͷ۠ผ • upstream ༻ͷ branch: ࠓճ͸ develop • deb ࡞੒༻ͷ branch: ࠓճ͸ debian ▶ debian branch Λ࡞ͬͯ debian σΟϨΫτϦҎԼΛίϛοτ͢Δ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 37 / 47
  46. gbp Λ࢖ͬͯΈΔ (2/3) ▶ ϦϙδτϦͷதʹ debian/gbp.conf Λ࡞੒ • ద༻ൣғ͝ͱʹϑΝΠϧ͕͍Δ –

    man gbp.conf [DEFAULT] upstream-branch=develop debian-branch=debian ▶ ଞʹ΋͍Ζ͍Ζͱઃఆඞཁ͔΋͠Εͳ͍Ͱ͕͢ʜʜ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 38 / 47
  47. gbp Λ࢖ͬͯΈΔ (3/3) ▶ gbp buildpackage ͕࢖͑ΔΑ͏ʹͳΔ • ࠩ෼ίϛοτલͳΒ --git-ignore-new

    Λ͚ͭΔ ▶ ͨͩ͠ɺຊ౰͸ git-pbuilder ͱ͔࢖͍·͠ΐ͏ • ࣗಈͰ cowbuilder/qemubuilder ࢖͏ͨΊͷϥού • sudo Ͱ͖ͳ͍ͱବ໨ • ࣄલʹ git-pbuilder create ͓͖ͯ͠·͠ΐ͏ • όʔδϣϯͷࢦఆ΋Ͱ͖ΔΑ!! DIST=stretch git-pbuilder খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 39 / 47
  48. Travis CI Λ࢖ͬͯΈΔ (1/4) ▶ GitHub Ͱ fork ͯ͠΋͛΋͍͛ͯͨ͠ •

    CI πʔϧΛ࢖͍͍ͨ • GitHub ͳΒ Travis CI ͕༗໊ ▶ http://travis.debian.net/ • Docker ΠϝʔδͷதͰΫϦʔϯϏϧυ؀ڥΛ࡞੒ͯ͠Ϗϧυ • ઃఆ͸ൺֱత؆୯ − git-buildpackage ͕࢖͑Δࣄ͕લఏ − GitHub ͱ Travis CI ͱͷ࿈ܞ − git ϦϙδτϦʹ.travis.yml Λ௥Ճ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 40 / 47
  49. Travis CI Λ࢖ͬͯΈΔ (2/4) sudo: required language: c++ env: global:

    - TRAVIS_DEBIAN_GIT_BUILDPACKAGE=\ "gbp buildpackage --git-upstream-tag=6afa215" - TRAVIS_DEBIAN_DISTRIBUTION="sid" - TRAVIS_DEBIAN_EXTRA_REPOSITORY_GPG_URL="" - TRAVIS_DEBIAN_EXTRA_REPOSITORY="" services: - docker script: - wget -O- http://travis.debian.net/script.sh | sh - branches: except: - /^debian\/\d/ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 41 / 47
  50. Travis CI Λ࢖ͬͯΈΔ (3/4) ▶ ποίϛͲ͜Ζ 1: --git-upstrem-tags ͬͯͳʹ? •

    ͜Ε΍Βͳ͍ͱౖΒΕ·ͨ͠ʜʜɻ • gbp.conf ʹ upstream ͷઃఆͯ͠ΔΜ͚ͩͲ? • tags ͷ஋͸ϋογϡͰ͍͍ͷͰ debian branch ੜ΍ͨ͠ίϛοτͷϋογϡΛೖΕ͍ͯΔ • 1liner ͰऔΕΔ % git show-branch --sha1-name debian develop | tail -1 \\ | grep -o '[[:alnum:]]*' | head -1 6afa215 খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 42 / 47
  51. Travis CI Λ࢖ͬͯΈΔ (4/4) ▶ ποίϛͲ͜Ζ 2: wget | sh

    - ͬͯͲ͏Α? • ެࣜճ౴ˣ Q: But wget | sh - is insecure! A: Of course, and you should never run such a command on your own machine. However, not only does Travis-CI build within throwaway containers that you are not responsible for, cannot trust, and generally don’t care about, there is zero expectation that the resulting .deb files are to be used or installed anywhere. ▶ ϏϧυͷνΣοΫ͚ͩͳΜ͔ͩΒؾʹ͢Δͳతͳճ౴ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 43 / 47
  52. ·ͱΊ (1/2) ▶ ͻͱ·ͣ tomighty ͷ deb Λͭ͘Γ CI ͰϏϧυνΣοΫ͢Δͱ͜Ζ·ͰͰ͖·ͨ͠

    ▶ ৭ʑͳ໰୊఺ • ͦ΋ͦ΋ upstream ͕։ൃதࢭͯ͠Δ ˠ Qt ͷษڧ͠Α͏͔ͳ͊ʜʜ • gbp ͷ࢖͍ํ͕Α͘Θ͔ͳ͍ʜʜ ˠ ࠓޙ׳Ε͍ͯ͜͏ • ࣮͸ lintian ͷܯࠂ͕͍ͬͺ͍ͷ͍ͬͯ͜Δ ˠ ಛʹ tomighty ͷ upstream ͕ ϙϞυʔϩΤϯδϯڞ༗ϥΠϒϥϦΛ࡞ΔͷͰౖΒΕΔ ˠ ͜͏͍͏৔߹Ͳ͏͢Δ͔ௐ͕ࠪඞཁ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 45 / 47
  53. ·ͱΊ (2/2) ▶ ͔ͳΓٱ͠ৼΓʹ deb ࡞ͬͯײͨ͜͡ͱ • dh ίϚϯυ͍͢͝ʜʜɻ Ͱ΋ރΕͯͳ͍ϏϧυγεςϜ͸

    ͝๙ඒҋ΋ਂͦ͏? • tar.gz Ͱ഑෍͞ΕͯΔιϑτͰ gbp ͸͔ͳΓศརͦ͏ɻ • pbuilder/cowbuilder ͢͹Β͍͠ • ࠓճ͸࢖Θͳ͔͚ͬͨͲ − qemubuilder ΋ࠓ౓ࢼͯ͠ΈΑ͏ɻ − quilt Ͱύονͷ؅ཧָ͕ʹͳͬͯΔɻ খྛ ࠀر (ؔ੢ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠࿩ 2017/02/26 46 / 47