Makefile 7.7 KB

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