Share
Embed
qmakeなQtアプリのdebを作ろうとして試行錯誤した話
第 120 回関西 Debian 勉強会で発表した、前年のパッケージング道場を受けてから、tomightyという、ポモドーロテクニック用のアプリのdebを作ろうとした話です。
Katsuki Kobayashi
February 26, 2017
Transcript
57 slides
-
qmake ͳ Qt ΞϓϦͷ deb Λ ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ - ୈ 120
ճ ؔ Debian ษڧձ ൃදࢿྉ - 2017 2 ݄ 26 খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 1 / 47 -
ຊͦ͏ͱࢥͬͯΔͷ ▶ ࣗݾհ • ࢲͷ Debian ྺ ▶ tomighty ˡ
ࠓճύοέʔδԽͨ͠ΞϓϦ • ϙϞυʔϩ ςΫχοΫ • qmake ▶ deb Խ • CDBS or dh • gbp • Travis CI (travis.debian.net) খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 2 / 47 -
ຊͦ͏ͱࢥͬͯΔͷ ▶ ࣗݾհ • ࢲͷ Debian ྺ ▶ tomighty ˡ
ࠓճύοέʔδԽͨ͠ΞϓϦ • ϙϞυʔϩ ςΫχοΫ • qmake ▶ deb Խ • CDBS or dh • gbp • Travis CI (travis.debian.net) ίϝϯτɺద͓ٓئ͍͠·͢ ࣌ؒͨͤΔࣗ৴ͳ͍ & ৲͢΅Έ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 2 / 47 -
ࣗݾհ (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 -
ࣗݾհ (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 -
ࣗݾհ (2/5) ▶ AS(Ξγελϯτελοϑ) ͱ͍͏ಾͷूஂ @ େֶ • gtach ͞Μ
(DD) • takaki ͞Μ (DD) • sugi ͞Μ (DM) • Wanderlust ։ൃऀͷҰਓ • plum, madoka ։ൃऀ (IRC ͖͗͢!?) • ࢲͷಉظͷ༑ਓ ˡ ࢲΑΓઌʹࡏ੶ɺͦͯ͠ઌʹൈ͚ͨʜʜ • ʑ ▶ ࢲ͕ೖͬͨͱ͖ɺ΄ͱΜͲͷํଔۀͨ͠ޙͰͨ͠ • Θ͟Θ͟େֶʹ͍ͳͯ͘ ϒϩʔυόϯυ͕Ոఉ·ͰདྷΔΑ͏ʹͳ͔ͬͨΒ͔ͳʜʜ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 4 / 47 -
ࣗݾհ (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 -
ࣗݾհ (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 -
ࣗݾհ (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 -
tomighty ▶ ࠓճ deb Λ࡞ͯ͠Έͨπʔϧ • Qt ΞϓϦ − λεΫόʔʹৗற͢ΔλΠϓ
− qmake(ޙड़) Λ͔ͭ͏ • ϙϞυʔϩɾςΫχοΫ (ޙड़) ༻ͷπʔϧ • http://tomighty.org/ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 8 / 47 -
ϙϞυʔϩɾςΫχοΫ ▶ 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 -
ͳΜͰϙϞυʔϩ? ▶ Rebuild.fm ͱ͍͏ϙουΩϟετͰհ͞Ε͍ͯͨ • Episodo 139: https://rebuild.fm/ • Perl
ϋοΧʔ (Plugger ࡞ऀ) ͷٶୡ͞Μ͕ϗετ • higepon ͞Μ͕հ − ٶ͞Μ͍ͬͯͨ − ͕ɺ࠷৽Τϐιʔυ (Ep.175) ͰʮΒͳ͘ͳͬͨʯͱʜʜ ▶ ʮ25 ʯͱ͍͏͕͞ΘΓͱΑ͍ • ͗ͣ͢ɺ͔͗ͣ͢ • ٳܜΛڧ੍తʹೖΕΔͷྑ͛͞ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 10 / 47 -
tomighty ࣮ԋʜʜ ▶ ͋Ε? ͳΜ͔͠ΐ΅͘ͳ͍? • ࣮ɺݩʑ Java Ͱॻ͔Ε͍ͯͨͷΛ Qt
Ͱॻ͖͍ͯ͠Δ • ձ͕ࣾ Windows ڥͳͷͰ Java ൛Λ͍ͬͯͨ • ݁ߏΑ͔ͬͨͷͰ Qt ൛͍͍ײ͡ͷͣ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 12 / 47 -
tomighty ࣮ԋʜʜ ▶ ͋Ε? ͳΜ͔͠ΐ΅͘ͳ͍? • ࣮ɺݩʑ Java Ͱॻ͔Ε͍ͯͨͷΛ Qt
Ͱॻ͖͍ͯ͠Δ • ձ͕ࣾ Windows ڥͳͷͰ Java ൛Λ͍ͬͯͨ • ݁ߏΑ͔ͬͨͷͰ Qt ൛͍͍ײ͡ͷͣ ͱࢥ͍ͬͯͨ࣌ظ͕ʹ͋Γ·ͨ͠ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 12 / 47 -
೦ͳ͓Βͤ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ
deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 13 / 47 -
೦ͳ͓Βͤ ▶ Qt ࣺͯΒΕɺ.NET ͱ Objective-C ʹͳ͍ͬͯͨʜʜɻ ▶ “fork me
on GitHub” ͷϦϯΫ͜͜ʹͳͬͯΔͷʹ!! ▶ ͱΓ͋͑ͣ͜ͷ··ਐΊ·͢ʜʜɻ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 13 / 47 -
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 -
qmake Λ͍ͬͯ͡ΈΔ (2/7) ▶ ͓ΉΖʹ qmake ͷόʔδϣϯΛݟͯΈ·͠ΐ͏ % qmake --version
খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 15 / 47 -
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 -
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 -
qmake Λ͍ͬͯ͡ΈΔ (3/7) ▶ -qt ΦϓγϣϯΛͬͯ Qt4 Λಈ͔ͯ͠ΈΔ % qmake
-qt=qt4 --version খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 16 / 47 -
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 -
qmake Λ͍ͬͯ͡ΈΔ (4/7) ▶ ڥม QT_SELECT Λͬͯ Qt4 Ͱಈ͔ͯ͠ΈΔ %
QT_SELECT=qt4 qmake --version খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 17 / 47 -
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 -
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 -
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 -
qmake Λ͍ͬͯ͡ΈΔ (7/7) ▶ qmake ʹ৯ͤ͞Δ.pro ϑΝΠϧ • qtcreator Ͱ࡞ͯ͘͠ΕΔ
• qtcreator - Integrated Development Environment for Qt খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 20 / 47 -
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 -
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 -
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 -
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 -
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 -
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 -
deb ʹͯ͠ΈΔ (3/10) ▶ ৭ʑͱμα͍ • override_* λʔήοτ͔Γ • ’cd
build’ ͔ͬΓ • ͦͦ࡞๏తʹͲ͏ͳΜ? খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 28 / 47 -
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 -
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 -
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 -
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 -
deb ʹͯ͠ΈΔ (7/10) ͕͔ͩ͠͠!! খྛ ࠀر (ؔ Debian ษڧձ) qmake
ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 32 / 47 -
deb ʹͯ͠ΈΔ (7/10) ͕͔ͩ͠͠!! pbuilder ͏ͱͳ͔ͥ qmake ͕ίέΔΑ͏ʹʜʜ qmake: could
not find a Qt installation of '' খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 32 / 47 -
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 -
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 -
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 -
ൃදޙهεϥΠυ ▶ ҎԼͷΑ͏ʹॻ͘ํ͕៉ྷͳΑ͏Ͱ͢ 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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
·ͱΊ (1/2) ▶ ͻͱ·ͣ tomighty ͷ deb Λͭ͘Γ CI ͰϏϧυνΣοΫ͢Δͱ͜Ζ·ͰͰ͖·ͨ͠
▶ ৭ʑͳ • ͦͦ upstream ͕։ൃதࢭͯ͠Δ ˠ Qt ͷษڧ͠Α͏͔ͳ͊ʜʜ • gbp ͷ͍ํ͕Α͘Θ͔ͳ͍ʜʜ ˠ ࠓޙ׳Ε͍ͯ͜͏ • ࣮ lintian ͷܯࠂ͕͍ͬͺ͍ͷ͍ͬͯ͜Δ ˠ ಛʹ tomighty ͷ upstream ͕ ϙϞυʔϩΤϯδϯڞ༗ϥΠϒϥϦΛ࡞ΔͷͰౖΒΕΔ ˠ ͜͏͍͏߹Ͳ͏͢Δ͔ௐ͕ࠪඞཁ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 45 / 47 -
·ͱΊ (2/2) ▶ ͔ͳΓٱ͠ৼΓʹ deb ࡞ͬͯײͨ͜͡ͱ • dh ίϚϯυ͍͢͝ʜʜɻ ͰރΕͯͳ͍ϏϧυγεςϜ
͝๙ඒҋਂͦ͏? • tar.gz Ͱ͞ΕͯΔιϑτͰ gbp ͔ͳΓศརͦ͏ɻ • pbuilder/cowbuilder ͢Β͍͠ • ࠓճΘͳ͔͚ͬͨͲ − qemubuilder ࠓࢼͯ͠ΈΑ͏ɻ − quilt Ͱύονͷཧָ͕ʹͳͬͯΔɻ খྛ ࠀر (ؔ Debian ษڧձ) qmake ͳ Qt ΞϓϦͷ deb Λ࡞Ζ͏ͱͯ͠ࢼߦࡨޡͨ͠ 2017/02/26 46 / 47