rpm+makefile: move build/install code to Makefile files

This makes build "scripts" not tied to Fedora-specific files. Especially
ease porting to other platforms.
This commit is contained in:
Marek Marczykowski-Górecki 2013-06-15 23:14:54 +02:00
parent fb353ea615
commit 0009805041
11 changed files with 184 additions and 100 deletions

View File

@ -28,3 +28,46 @@ rpms-dom0:
clean: clean:
make -C dispvm clean make -C dispvm clean
make -C qmemman clean make -C qmemman clean
all:
# core core-modules qmemman
make all -C core
make all -C core-modules
make all -C qmemman
make all -C dispvm
make all -C tests
install:
$(MAKE) install -C linux/systemd
$(MAKE) install -C linux/aux-tools
$(MAKE) install -C linux/system-config
$(MAKE) install -C qvm-tools
$(MAKE) install -C core
$(MAKE) install -C core-modules
$(MAKE) install -C qmemman
$(MAKE) install -C dispvm
$(MAKE) install -C tests
mkdir -p $(DESTDIR)/etc/qubes-rpc/policy
cp qubes-rpc-policy/qubes.Filecopy.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.Filecopy
cp qubes-rpc-policy/qubes.OpenInVM.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.OpenInVM
cp qubes-rpc-policy/qubes.VMShell.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.VMShell
cp qubes-rpc-policy/qubes.NotifyUpdates.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyUpdates
cp qubes-rpc-policy/qubes.NotifyTools.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.NotifyTools
cp qubes-rpc-policy/qubes.GetImageRGBA.policy $(DESTDIR)/etc/qubes-rpc/policy/qubes.GetImageRGBA
cp qubes-rpc/qubes.NotifyUpdates $(DESTDIR)/etc/qubes-rpc/
cp qubes-rpc/qubes.NotifyTools $(DESTDIR)/etc/qubes-rpc/
cp qubes-rpc/qubes-notify-updates $(DESTDIR)/usr/lib/qubes/
cp qubes-rpc/qubes-notify-tools $(DESTDIR)/usr/lib/qubes/
mkdir -p $(DESTDIR)/usr/share/qubes
cp xen-vm-config/vm-template.xml $(DESTDIR)/usr/share/qubes/xen-vm-template.xml
cp xen-vm-config/vm-template-hvm.xml $(DESTDIR)/usr/share/qubes/
mkdir -p $(DESTDIR)/var/lib/qubes
mkdir -p $(DESTDIR)/var/lib/qubes/vm-templates
mkdir -p $(DESTDIR)/var/lib/qubes/appvms
mkdir -p $(DESTDIR)/var/lib/qubes/servicevms
mkdir -p $(DESTDIR)/var/lib/qubes/vm-kernels
mkdir -p $(DESTDIR)/var/lib/qubes/backup
mkdir -p $(DESTDIR)/var/lib/qubes/dvmdata
mkdir -p $(DESTDIR)/var/log/qubes
mkdir -p $(DESTDIR)/var/run/qubes

15
core-modules/Makefile Normal file
View File

@ -0,0 +1,15 @@
PYTHON_QUBESMODPATH = $(PYTHON_SITEPATH)/qubes/modules
all:
python -m compileall .
python -O -m compileall .
install:
ifndef PYTHON_SITEPATH
$(error PYTHON_SITEPATH not defined)
endif
mkdir -p $(DESTDIR)$(PYTHON_QUBESMODPATH)
cp 0*.py $(DESTDIR)$(PYTHON_QUBESMODPATH)
cp 0*.py[co] $(DESTDIR)$(PYTHON_QUBESMODPATH)
cp __init__.py $(DESTDIR)$(PYTHON_QUBESMODPATH)
cp __init__.py[co] $(DESTDIR)$(PYTHON_QUBESMODPATH)

21
core/Makefile Normal file
View File

@ -0,0 +1,21 @@
PYTHON_QUBESPATH = $(PYTHON_SITEPATH)/qubes
all:
python -m compileall .
python -O -m compileall .
install:
ifndef PYTHON_SITEPATH
$(error PYTHON_SITEPATH not defined)
endif
mkdir -p $(DESTDIR)$(PYTHON_QUBESPATH)
cp qubes.py $(DESTDIR)$(PYTHON_QUBESPATH)
cp qubes.py[co] $(DESTDIR)$(PYTHON_QUBESPATH)
cp qubesutils.py $(DESTDIR)$(PYTHON_QUBESPATH)
cp qubesutils.py[co] $(DESTDIR)$(PYTHON_QUBESPATH)
cp guihelpers.py $(DESTDIR)$(PYTHON_QUBESPATH)
cp guihelpers.py[co] $(DESTDIR)$(PYTHON_QUBESPATH)
cp notify.py $(DESTDIR)$(PYTHON_QUBESPATH)
cp notify.py[co] $(DESTDIR)$(PYTHON_QUBESPATH)
cp backup.py $(DESTDIR)$(PYTHON_QUBESPATH)
cp backup.py[co] $(DESTDIR)$(PYTHON_QUBESPATH)

View File

@ -7,3 +7,13 @@ xenstore-watch: xenstore-watch.o
clean: clean:
rm -f *.o *~ qubes-restore xenstore-watch xenfreepages rm -f *.o *~ qubes-restore xenstore-watch xenfreepages
install:
mkdir -p $(DESTDIR)/etc/xen/scripts
cp block.qubes $(DESTDIR)/etc/xen/scripts
mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/lib/qubes
cp xenstore-watch $(DESTDIR)/usr/bin/xenstore-watch-qubes
cp qubes-prepare-saved-domain.sh $(DESTDIR)/usr/lib/qubes
cp qubes-update-dispvm-savefile-with-progress.sh $(DESTDIR)/usr/lib/qubes
cp qfile-daemon-dvm $(DESTDIR)/usr/lib/qubes

15
linux/aux-tools/Makefile Normal file
View File

@ -0,0 +1,15 @@
all:
true
install:
mkdir -p $(DESTDIR)/usr/lib/qubes
cp unbind-pci-device.sh $(DESTDIR)/usr/lib/qubes
cp cleanup-dispvms $(DESTDIR)/usr/lib/qubes
cp startup-dvm.sh $(DESTDIR)/usr/lib/qubes
cp startup-misc.sh $(DESTDIR)/usr/lib/qubes
cp prepare-volatile-img.sh $(DESTDIR)/usr/lib/qubes
cp vusb-ctl.py $(DESTDIR)/usr/lib/qubes/
cp xl-qvm-usb-attach.py $(DESTDIR)/usr/lib/qubes/
cp xl-qvm-usb-detach.py $(DESTDIR)/usr/lib/qubes/
cp block-cleaner-daemon.py $(DESTDIR)/usr/lib/qubes/
cp fix-dir-perms.sh $(DESTDIR)/usr/lib/qubes/

View File

@ -0,0 +1,10 @@
all:
true
install:
mkdir -p $(DESTDIR)/etc/xen/scripts
cp vif-route-qubes $(DESTDIR)/etc/xen/scripts
cp block-snapshot $(DESTDIR)/etc/xen/scripts
ln -s block-snapshot $(DESTDIR)/etc/xen/scripts/block-origin
install -d $(DESTDIR)/etc/xdg/autostart
install -m 0644 qubes-guid.desktop $(DESTDIR)/etc/xdg/autostart/

16
linux/systemd/Makefile Normal file
View File

@ -0,0 +1,16 @@
UNITDIR ?= /usr/lib/systemd/system
all:
true
install:
mkdir -p $(DESTDIR)$(UNITDIR)
cp qubes-block-cleaner.service $(DESTDIR)$(UNITDIR)
cp qubes-core.service $(DESTDIR)$(UNITDIR)
cp qubes-setupdvm.service $(DESTDIR)$(UNITDIR)
cp qubes-meminfo-writer.service $(DESTDIR)$(UNITDIR)
cp qubes-netvm.service $(DESTDIR)$(UNITDIR)
cp qubes-qmemman.service $(DESTDIR)$(UNITDIR)
cp qubes-vm@.service $(DESTDIR)$(UNITDIR)
cp qubes-reload-firewall@.service $(DESTDIR)$(UNITDIR)
cp qubes-reload-firewall@.timer $(DESTDIR)$(UNITDIR)

View File

@ -1,5 +1,21 @@
PYTHON_QUBESPATH = $(PYTHON_SITEPATH)/qubes
SYSCONFDIR ?= /etc
all: all:
python -m compileall .
python -O -m compileall .
clean: clean:
rm -f *.pyo rm -f *.pyo
install:
ifndef PYTHON_SITEPATH
$(error PYTHON_SITEPATH not defined)
endif
mkdir -p $(DESTDIR)$(PYTHON_QUBESPATH)
cp qmemman*py $(DESTDIR)$(PYTHON_QUBESPATH)
cp qmemman*py[co] $(DESTDIR)$(PYTHON_QUBESPATH)
mkdir -p $(DESTDIR)$(SYSCONFDIR)/qubes
cp qmemman.conf $(DESTDIR)$(SYSCONFDIR)/qubes/
mkdir -p $(DESTDIR)/usr/lib/qubes
cp server.py $(DESTDIR)/usr/lib/qubes/qmemman_daemon.py

10
qvm-tools/Makefile Normal file
View File

@ -0,0 +1,10 @@
BINDIR ?= /usr/bin
all:
true
install:
mkdir -p $(DESTDIR)$(BINDIR)
cp qvm-* $(DESTDIR)$(BINDIR)
cp qubes-* $(DESTDIR)$(BINDIR)

View File

@ -81,109 +81,16 @@ ln -sf . %{name}-%{version}
%setup -T -D %setup -T -D
%build %build
python -m compileall core core-modules qmemman tests
python -O -m compileall core dom/core-modules qmemman tests make all
for dir in dispvm qmemman; do
(cd $dir; make)
done
%install %install
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system make install \
cp linux/systemd/qubes-block-cleaner.service $RPM_BUILD_ROOT%{_unitdir} DESTDIR=$RPM_BUILD_ROOT \
cp linux/systemd/qubes-core.service $RPM_BUILD_ROOT%{_unitdir} UNITDIR=%{_unitdir} \
cp linux/systemd/qubes-setupdvm.service $RPM_BUILD_ROOT%{_unitdir} PYTHON_SITEPATH=%{python_sitearch} \
cp linux/systemd/qubes-netvm.service $RPM_BUILD_ROOT%{_unitdir} SYSCONFDIR=%{_sysconfdir}
cp linux/systemd/qubes-qmemman.service $RPM_BUILD_ROOT%{_unitdir}
cp linux/systemd/qubes-vm@.service $RPM_BUILD_ROOT%{_unitdir}
cp linux/systemd/qubes-reload-firewall@.service $RPM_BUILD_ROOT%{_unitdir}
cp linux/systemd/qubes-reload-firewall@.timer $RPM_BUILD_ROOT%{_unitdir}
mkdir -p $RPM_BUILD_ROOT/usr/bin/
cp qvm-tools/qvm-* $RPM_BUILD_ROOT/usr/bin
cp qvm-tools/qubes-* $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/etc/xen/scripts
cp dispvm/block.qubes $RPM_BUILD_ROOT/etc/xen/scripts
cp linux/system-config/vif-route-qubes $RPM_BUILD_ROOT/etc/xen/scripts
cp linux/system-config/block-snapshot $RPM_BUILD_ROOT/etc/xen/scripts
ln -s block-snapshot $RPM_BUILD_ROOT/etc/xen/scripts/block-origin
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/qubes.py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/qubes.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/qubesutils.py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/qubesutils.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/guihelpers.py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/guihelpers.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/notify.py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/notify.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/backup.py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp core/backup.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp qmemman/qmemman*py $RPM_BUILD_ROOT%{python_sitearch}/qubes
cp qmemman/qmemman*py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
cp core-modules/0*.py $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
cp core-modules/0*.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
cp core-modules/__init__.py $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
cp core-modules/__init__.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubes/tests
cp tests/*.py $RPM_BUILD_ROOT%{python_sitearch}/qubes/tests/
cp tests/*.py[co] $RPM_BUILD_ROOT%{python_sitearch}/qubes/tests/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/qubes
cp qmemman/qmemman.conf $RPM_BUILD_ROOT%{_sysconfdir}/qubes/
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
cp linux/aux-tools/unbind-pci-device.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp linux/aux-tools/cleanup-dispvms $RPM_BUILD_ROOT/usr/lib/qubes
cp linux/aux-tools/startup-dvm.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp linux/aux-tools/startup-misc.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp linux/aux-tools/prepare-volatile-img.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp qmemman/server.py $RPM_BUILD_ROOT/usr/lib/qubes/qmemman_daemon.py
cp qubes-rpc/qubes-notify-tools $RPM_BUILD_ROOT/usr/lib/qubes/
cp qubes-rpc/qubes-notify-updates $RPM_BUILD_ROOT/usr/lib/qubes/
cp linux/aux-tools/vusb-ctl.py $RPM_BUILD_ROOT/usr/lib/qubes/
cp linux/aux-tools/xl-qvm-usb-attach.py $RPM_BUILD_ROOT/usr/lib/qubes/
cp linux/aux-tools/xl-qvm-usb-detach.py $RPM_BUILD_ROOT/usr/lib/qubes/
cp linux/aux-tools/block-cleaner-daemon.py $RPM_BUILD_ROOT/usr/lib/qubes/
cp linux/aux-tools/fix-dir-perms.sh $RPM_BUILD_ROOT/usr/lib/qubes/
mkdir -p $RPM_BUILD_ROOT/etc/qubes-rpc/policy
cp qubes-rpc-policy/qubes.Filecopy.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.Filecopy
cp qubes-rpc-policy/qubes.GetImageRGBA.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.GetImageRGBA
cp qubes-rpc-policy/qubes.OpenInVM.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.OpenInVM
cp qubes-rpc-policy/qubes.VMShell.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.VMShell
cp qubes-rpc-policy/qubes.NotifyTools.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.NotifyTools
cp qubes-rpc/qubes.NotifyTools $RPM_BUILD_ROOT/etc/qubes-rpc/
cp qubes-rpc-policy/qubes.NotifyUpdates.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.NotifyUpdates
cp qubes-rpc/qubes.NotifyUpdates $RPM_BUILD_ROOT/etc/qubes-rpc/
cp dispvm/xenstore-watch $RPM_BUILD_ROOT/usr/bin/xenstore-watch-qubes
cp dispvm/qubes-prepare-saved-domain.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp dispvm/qubes-update-dispvm-savefile-with-progress.sh $RPM_BUILD_ROOT/usr/lib/qubes
cp dispvm/qfile-daemon-dvm $RPM_BUILD_ROOT/usr/lib/qubes
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/vm-templates
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/appvms
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/servicevms
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/vm-kernels
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/backup
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/dvmdata
mkdir -p $RPM_BUILD_ROOT/usr/share/qubes
cp xen-vm-config/vm-template.xml $RPM_BUILD_ROOT/usr/share/qubes/xen-vm-template.xml
cp xen-vm-config/vm-template-hvm.xml $RPM_BUILD_ROOT/usr/share/qubes/
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/var/log/qubes
mkdir -p $RPM_BUILD_ROOT/var/run/qubes
install -d $RPM_BUILD_ROOT/etc/xdg/autostart
install -m 0644 linux/system-config/qubes-guid.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/
%post %post

21
tests/Makefile Normal file
View File

@ -0,0 +1,21 @@
PYTHON_TESTSPATH = $(PYTHON_SITEPATH)/qubes/tests
all:
python -m compileall .
python -O -m compileall .
install:
ifndef PYTHON_SITEPATH
$(error PYTHON_SITEPATH not defined)
endif
mkdir -p $(DESTDIR)$(PYTHON_TESTSPATH)
cp __init__.py $(DESTDIR)$(PYTHON_TESTSPATH)
cp __init__.py[co] $(DESTDIR)$(PYTHON_TESTSPATH)
cp backup.py $(DESTDIR)$(PYTHON_TESTSPATH)
cp backup.py[co] $(DESTDIR)$(PYTHON_TESTSPATH)
cp backupcompatibility.py $(DESTDIR)$(PYTHON_TESTSPATH)
cp backupcompatibility.py[co] $(DESTDIR)$(PYTHON_TESTSPATH)
cp basic.py $(DESTDIR)$(PYTHON_TESTSPATH)
cp basic.py[co] $(DESTDIR)$(PYTHON_TESTSPATH)
cp vm_qrexec_gui.py $(DESTDIR)$(PYTHON_TESTSPATH)
cp vm_qrexec_gui.py[co] $(DESTDIR)$(PYTHON_TESTSPATH)