snapcraft.yaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. name: ozwdaemon
  2. base: core20
  3. adopt-info: set-version
  4. summary: "QT Wrapper for OpenZWave. Remotely manage a Z-Wave Network."
  5. description: |
  6. A dedicated snap package that contains only the ozwdaemon service.
  7. This snap contains only the ozwdaemon application and none of the management tools. Use Home Assistant or OZW Admin to connect to it.
  8. NOTE! To add secure devices through Home Assistant, you have to make service calls, with the payload:
  9. ```
  10. {
  11. "secure": true,
  12. "instance_id": <id given in configuration>
  13. }
  14. ```
  15. This is an issue with the OpenZWave integration of Home Assistant and will hopefully be fixed in the future.
  16. See `snap get ozwdaemon -d` for configuration options.
  17. grade: stable
  18. confinement: strict
  19. layout:
  20. /usr/local/share/OpenZWave/qt-openzwavedatabase.rcc:
  21. bind-file: $SNAP/usr/share/qt5/qt-openzwavedatabase.rcc
  22. apps:
  23. ozwdaemon:
  24. daemon: simple
  25. restart-condition: on-failure
  26. command: usr/local/bin/ozwdaemon
  27. command-chain:
  28. - bin/env-wrapper
  29. plugs:
  30. - network
  31. - network-bind
  32. - raw-usb
  33. enable:
  34. command: bin/daemonize
  35. disable:
  36. command: bin/de-daemonize
  37. restart:
  38. command: bin/restart
  39. exec:
  40. command: usr/local/bin/ozwdaemon --exec
  41. command-chain:
  42. - bin/env-wrapper
  43. plugs:
  44. - network
  45. - network-bind
  46. - raw-usb
  47. parts:
  48. open-zwave:
  49. plugin: make
  50. source: https://github.com/OpenZWave/open-zwave.git
  51. qtmqtt:
  52. after: [open-zwave]
  53. plugin: make # aka qmake
  54. source: https://github.com/qt/qtmqtt.git
  55. source-tag: 5.12.8
  56. build-packages:
  57. - build-essential
  58. - qt5-default
  59. - qtbase5-private-dev
  60. override-build: |
  61. if [ -f "Makefile" ]; then
  62. echo "Clean $SNAPCRAFT_PART_BUILD"
  63. qmake -r
  64. make distclean
  65. fi
  66. qmake
  67. make -j$(nproc)
  68. make -j$(nproc) install
  69. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  70. override-prime: |
  71. snapcraftctl prime
  72. stage-packages:
  73. - libdouble-conversion3
  74. - libfreetype6
  75. - libgl1
  76. - libglvnd0
  77. - libglx0
  78. - libgraphite2-3
  79. - libharfbuzz0b
  80. - libicu66
  81. - libpcre2-16-0
  82. - libpng16-16
  83. - libqt5core5a
  84. - libqt5gui5
  85. - libqt5network5
  86. - libqt5websockets5
  87. - libqt5widgets5
  88. - libx11-6
  89. - libxau6
  90. - libxcb1
  91. - libxdmcp6
  92. qt-openzwave:
  93. after: [open-zwave, qtmqtt]
  94. plugin: make # aka qmake?
  95. source: https://github.com/OpenZWave/qt-openzwave.git
  96. build-packages:
  97. - build-essential
  98. - qt5-default
  99. - libqt5websockets5-dev
  100. - libqt5remoteobjects5-dev
  101. - libqt5remoteobjects5-bin
  102. - gcc-8-base
  103. - libgcc-8-dev
  104. - cmake
  105. - pkgconf
  106. - libunwind-dev
  107. - libcurl4-openssl-dev
  108. - rapidjson-dev
  109. stage-packages:
  110. - libdouble-conversion3
  111. - libicu66
  112. - libpcre2-16-0
  113. - libqt5core5a
  114. - libqt5network5
  115. - libqt5remoteobjects5
  116. - libqt5websockets5
  117. - libunwind8
  118. override-build: |
  119. if [ -f "Makefile" ]; then
  120. echo "Clean $SNAPCRAFT_PART_BUILD"
  121. qmake -r
  122. make distclean
  123. fi
  124. INSTALL_PATH="${HOME}"
  125. if [ ! -z ${container+x} ]; then
  126. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  127. fi
  128. OZW_LIB_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name libopenzwave.so -print0 -quit))"
  129. OZW_INCLUDE_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name Manager.h -print0 -quit))"
  130. OZW_DATABASE_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name manufacturer_specific.xml))"
  131. qmake -r "CONFIG+=release" \
  132. OZW_LIB_PATH="${OZW_LIB_PATH}" \
  133. OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \
  134. OZW_DATABASE_PATH="${OZW_DATABASE_PATH}"
  135. make -j$(nproc)
  136. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  137. local-src:
  138. after: [qt-openzwave]
  139. plugin: dump
  140. source: ./src
  141. source-type: local
  142. stage-packages:
  143. - coreutils
  144. - netcat-openbsd
  145. organize:
  146. hooks: snap/hooks
  147. set-version:
  148. after: [qt-openzwave]
  149. plugin: nil
  150. override-build: |
  151. set -ex
  152. INSTALL_PATH="${HOME}"
  153. if [ ! -z ${container+x} ]; then
  154. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  155. fi
  156. LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)")
  157. LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)")
  158. LIB_OZWDB=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwavedatabase.so.1 -print -quit)")
  159. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB
  160. OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit)
  161. snapcraftctl set-version "$($OZWD --version | cut -f2 -d ' ')"