Makefile 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. RPMS_DIR=rpm/
  2. VERSION := $(shell cat version)
  3. DIST_DOM0 ?= fc18
  4. OS ?= Linux
  5. PYTHON ?= python3
  6. ADMIN_API_METHODS_SIMPLE = \
  7. admin.vmclass.List \
  8. admin.Events \
  9. admin.backup.Execute \
  10. admin.backup.Info \
  11. admin.backup.Cancel \
  12. admin.label.Create \
  13. admin.label.Get \
  14. admin.label.List \
  15. admin.label.Index \
  16. admin.label.Remove \
  17. admin.pool.Add \
  18. admin.pool.Info \
  19. admin.pool.List \
  20. admin.pool.ListDrivers \
  21. admin.pool.Remove \
  22. admin.pool.Set.revisions_to_keep \
  23. admin.pool.volume.Info \
  24. admin.pool.volume.List \
  25. admin.pool.volume.ListSnapshots \
  26. admin.pool.volume.Resize \
  27. admin.pool.volume.Revert \
  28. admin.pool.volume.Set.revisions_to_keep \
  29. admin.pool.volume.Set.rw \
  30. admin.pool.volume.Snapshot \
  31. admin.property.Get \
  32. admin.property.GetDefault \
  33. admin.property.Help \
  34. admin.property.HelpRst \
  35. admin.property.List \
  36. admin.property.Reset \
  37. admin.property.Set \
  38. admin.vm.Create.AppVM \
  39. admin.vm.Create.DispVM \
  40. admin.vm.Create.StandaloneVM \
  41. admin.vm.Create.TemplateVM \
  42. admin.vm.CreateInPool.AppVM \
  43. admin.vm.CreateInPool.DispVM \
  44. admin.vm.CreateInPool.StandaloneVM \
  45. admin.vm.CreateInPool.TemplateVM \
  46. admin.vm.CreateDisposable \
  47. admin.vm.Kill \
  48. admin.vm.List \
  49. admin.vm.Pause \
  50. admin.vm.Remove \
  51. admin.vm.Shutdown \
  52. admin.vm.Start \
  53. admin.vm.Unpause \
  54. admin.vm.device.pci.Attach \
  55. admin.vm.device.pci.Available \
  56. admin.vm.device.pci.Detach \
  57. admin.vm.device.pci.List \
  58. admin.vm.device.pci.Set.persistent \
  59. admin.vm.device.block.Attach \
  60. admin.vm.device.block.Available \
  61. admin.vm.device.block.Detach \
  62. admin.vm.device.block.List \
  63. admin.vm.device.block.Set.persistent \
  64. admin.vm.device.mic.Attach \
  65. admin.vm.device.mic.Available \
  66. admin.vm.device.mic.Detach \
  67. admin.vm.device.mic.List \
  68. admin.vm.device.mic.Set.persistent \
  69. admin.vm.feature.CheckWithNetvm \
  70. admin.vm.feature.CheckWithTemplate \
  71. admin.vm.feature.Get \
  72. admin.vm.feature.List \
  73. admin.vm.feature.Remove \
  74. admin.vm.feature.Set \
  75. admin.vm.firewall.Flush \
  76. admin.vm.firewall.Get \
  77. admin.vm.firewall.Set \
  78. admin.vm.firewall.GetPolicy \
  79. admin.vm.firewall.SetPolicy \
  80. admin.vm.firewall.Reload \
  81. admin.vm.property.Get \
  82. admin.vm.property.GetDefault \
  83. admin.vm.property.Help \
  84. admin.vm.property.HelpRst \
  85. admin.vm.property.List \
  86. admin.vm.property.Reset \
  87. admin.vm.property.Set \
  88. admin.vm.tag.Get \
  89. admin.vm.tag.List \
  90. admin.vm.tag.Remove \
  91. admin.vm.tag.Set \
  92. admin.vm.volume.CloneFrom \
  93. admin.vm.volume.CloneTo \
  94. admin.vm.volume.Info \
  95. admin.vm.volume.List \
  96. admin.vm.volume.ListSnapshots \
  97. admin.vm.volume.Resize \
  98. admin.vm.volume.Revert \
  99. admin.vm.volume.Set.revisions_to_keep \
  100. admin.vm.volume.Set.rw \
  101. admin.vm.Stats \
  102. $(null)
  103. ifeq ($(OS),Linux)
  104. DATADIR ?= /var/lib/qubes
  105. STATEDIR ?= /var/run/qubes
  106. LOGDIR ?= /var/log/qubes
  107. FILESDIR ?= /usr/share/qubes
  108. else ifeq ($(OS),Windows_NT)
  109. DATADIR ?= c:/qubes
  110. STATEDIR ?= c:/qubes/state
  111. LOGDIR ?= c:/qubes/log
  112. FILESDIR ?= c:/program files/Invisible Things Lab/Qubes
  113. endif
  114. help:
  115. @echo "make rpms -- generate binary rpm packages"
  116. @echo "make rpms-dom0 -- generate binary rpm packages for Dom0"
  117. @echo "make update-repo-current -- copy newly generated rpms to qubes yum repo"
  118. @echo "make update-repo-current-testing -- same, but to -current-testing repo"
  119. @echo "make update-repo-unstable -- same, but to -testing repo"
  120. @echo "make update-repo-installer -- copy dom0 rpms to installer repo"
  121. @echo "make clean -- cleanup"
  122. rpms: rpms-dom0
  123. rpms-vm:
  124. @true
  125. rpms-dom0:
  126. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-dom0.spec
  127. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-dom0-doc.spec
  128. rpm --addsign \
  129. $(RPMS_DIR)/x86_64/qubes-core-dom0-$(VERSION)*.rpm \
  130. $(RPMS_DIR)/noarch/qubes-core-dom0-doc-$(VERSION)*rpm
  131. all:
  132. $(PYTHON) setup.py build
  133. $(MAKE) -C qubes-rpc all
  134. # make all -C tests
  135. # Currently supported only on xen
  136. install:
  137. ifeq ($(OS),Linux)
  138. $(MAKE) install -C linux/systemd
  139. $(MAKE) install -C linux/aux-tools
  140. $(MAKE) install -C linux/system-config
  141. endif
  142. $(PYTHON) setup.py install -O1 --skip-build --root $(DESTDIR)
  143. ln -s qvm-device $(DESTDIR)/usr/bin/qvm-block
  144. ln -s qvm-device $(DESTDIR)/usr/bin/qvm-pci
  145. ln -s qvm-device $(DESTDIR)/usr/bin/qvm-usb
  146. install -d $(DESTDIR)/usr/share/man/man1
  147. ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-block.1.gz
  148. ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-pci.1.gz
  149. ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-usb.1.gz
  150. # $(MAKE) install -C tests
  151. $(MAKE) install -C relaxng
  152. mkdir -p $(DESTDIR)/etc/qubes
  153. ifeq ($(BACKEND_VMM),xen)
  154. # Currently supported only on xen
  155. cp etc/qmemman.conf $(DESTDIR)/etc/qubes/
  156. endif
  157. mkdir -p $(DESTDIR)/etc/qubes-rpc/policy
  158. mkdir -p $(DESTDIR)/usr/libexec/qubes
  159. cp qubes-rpc-policy/qubes.FeaturesRequest.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.FeaturesRequest
  160. cp qubes-rpc-policy/qubes.Filecopy.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.Filecopy
  161. cp qubes-rpc-policy/qubes.OpenInVM.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.OpenInVM
  162. cp qubes-rpc-policy/qubes.OpenURL.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.OpenURL
  163. cp qubes-rpc-policy/qubes.VMShell.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.VMShell
  164. cp qubes-rpc-policy/qubes.VMRootShell.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.VMRootShell
  165. cp qubes-rpc-policy/qubes.NotifyUpdates.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyUpdates
  166. cp qubes-rpc-policy/qubes.NotifyTools.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyTools
  167. cp qubes-rpc-policy/qubes.GetImageRGBA.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.GetImageRGBA
  168. cp qubes-rpc-policy/qubes.GetRandomizedTime.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.GetRandomizedTime
  169. cp qubes-rpc-policy/qubes.NotifyTools.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyTools
  170. cp qubes-rpc-policy/qubes.NotifyUpdates.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyUpdates
  171. cp qubes-rpc-policy/qubes.OpenInVM.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.OpenInVM
  172. cp qubes-rpc-policy/qubes.StartApp.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.StartApp
  173. cp qubes-rpc-policy/qubes.VMShell.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.VMShell
  174. cp qubes-rpc-policy/qubes.UpdatesProxy.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.UpdatesProxy
  175. cp qubes-rpc-policy/qubes.GetDate.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.GetDate
  176. cp qubes-rpc-policy/policy.RegisterArgument.policy $(DESTDIR)/etc/qubes-rpc/policy/policy.RegisterArgument
  177. cp qubes-rpc/qubes.FeaturesRequest $(DESTDIR)/etc/qubes-rpc/
  178. cp qubes-rpc/qubes.GetDate $(DESTDIR)/etc/qubes-rpc/
  179. cp qubes-rpc/qubes.GetRandomizedTime $(DESTDIR)/etc/qubes-rpc/
  180. cp qubes-rpc/qubes.NotifyTools $(DESTDIR)/etc/qubes-rpc/
  181. cp qubes-rpc/qubes.NotifyUpdates $(DESTDIR)/etc/qubes-rpc/
  182. cp qubes-rpc/policy.RegisterArgument $(DESTDIR)/etc/qubes-rpc/
  183. install qubes-rpc/qubesd-query-fast $(DESTDIR)/usr/libexec/qubes/
  184. install -m 0755 qvm-tools/qubes-bug-report $(DESTDIR)/usr/bin/qubes-bug-report
  185. install -m 0755 qvm-tools/qubes-hcl-report $(DESTDIR)/usr/bin/qubes-hcl-report
  186. install -m 0755 qvm-tools/qvm-sync-clock $(DESTDIR)/usr/bin/qvm-sync-clock
  187. for method in $(ADMIN_API_METHODS_SIMPLE); do \
  188. ln -s ../../usr/libexec/qubes/qubesd-query-fast \
  189. $(DESTDIR)/etc/qubes-rpc/$$method || exit 1; \
  190. done
  191. install qubes-rpc/admin.vm.volume.Import $(DESTDIR)/etc/qubes-rpc/
  192. PYTHONPATH=.:test-packages qubes-rpc-policy/generate-admin-policy \
  193. --destdir=$(DESTDIR)/etc/qubes-rpc/policy \
  194. --exclude admin.vm.Create.AdminVM \
  195. admin.vm.CreateInPool.AdminVM \
  196. admin.vm.device.testclass.Attach \
  197. admin.vm.device.testclass.Detach \
  198. admin.vm.device.testclass.List \
  199. admin.vm.device.testclass.Set.persistent \
  200. admin.vm.device.testclass.Available
  201. # sanity check
  202. for method in $(DESTDIR)/etc/qubes-rpc/policy/admin.*; do \
  203. ls $(DESTDIR)/etc/qubes-rpc/$$(basename $$method) >/dev/null || exit 1; \
  204. done
  205. install -d $(DESTDIR)/etc/qubes-rpc/policy/include
  206. install -m 0644 qubes-rpc-policy/admin-local-ro \
  207. qubes-rpc-policy/admin-local-rwx \
  208. qubes-rpc-policy/admin-global-ro \
  209. qubes-rpc-policy/admin-global-rwx \
  210. $(DESTDIR)/etc/qubes-rpc/policy/include/
  211. mkdir -p "$(DESTDIR)$(FILESDIR)"
  212. cp -r templates "$(DESTDIR)$(FILESDIR)/templates"
  213. rm -f "$(DESTDIR)$(FILESDIR)/templates/README"
  214. mkdir -p $(DESTDIR)$(DATADIR)
  215. mkdir -p $(DESTDIR)$(DATADIR)/vm-templates
  216. mkdir -p $(DESTDIR)$(DATADIR)/appvms
  217. mkdir -p $(DESTDIR)$(DATADIR)/servicevms
  218. mkdir -p $(DESTDIR)$(DATADIR)/vm-kernels
  219. mkdir -p $(DESTDIR)$(DATADIR)/backup
  220. mkdir -p $(DESTDIR)$(DATADIR)/dvmdata
  221. mkdir -p $(DESTDIR)$(STATEDIR)
  222. mkdir -p $(DESTDIR)$(LOGDIR)
  223. msi:
  224. rm -rf destinstdir
  225. mkdir -p destinstdir
  226. $(MAKE) install \
  227. DESTDIR=$(PWD)/destinstdir \
  228. PYTHON_SITEPATH=/site-packages \
  229. FILESDIR=/pfiles \
  230. BINDIR=/bin \
  231. DATADIR=/qubes \
  232. STATEDIR=/qubes/state \
  233. LOGDIR=/qubes/log
  234. # icons placeholder
  235. mkdir -p destinstdir/icons
  236. for i in blue gray green yellow orange black purple red; do touch destinstdir/icons/$$i.png; done
  237. candle -arch x64 -dversion=$(VERSION) installer.wxs
  238. light -b destinstdir -o core-admin.msm installer.wixobj
  239. rm -rf destinstdir