Makefile 7.8 KB

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