Makefile 9.4 KB

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