[Kimchi-devel] [PATCH] add an option do not build fonts files in rpm packages

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Fri Jul 11 13:37:04 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

configure will do not generate ui/css/fonts/novnc/Makefile and
ui/css/fonts/Makefile when build fonts are disabled.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
---
 Makefile.am                   |  6 +++++-
 configure.ac                  | 24 ++++++++++++++++++++++--
 contrib/kimchi.spec.fedora.in |  4 +++-
 ui/css/Makefile.am            |  4 ++++
 4 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9785de9..e6ff673 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,6 +19,10 @@
 
 SUBDIRS = src ui docs contrib tests po config plugins
 
+if FONTS
+WITH_FONTS = --define="with_fonts 1"
+endif
+
 ACLOCAL_AMFLAGS = --install -I m4
 
 EXTRA_DIST = \
@@ -134,7 +138,7 @@ rpm: dist kimchi.spec
 	$(MKDIR_P) rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
 	cp $(top_srcdir)/kimchi.spec rpm/SPECS/kimchi.spec
 	cp $(DIST_ARCHIVES) rpm/SOURCES
-	rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec
+	rpmbuild -ba $(WITH_FONTS) --define "_topdir `pwd`/rpm" rpm/SPECS/kimchi.spec
 
 fedora-rpm: contrib/kimchi.spec.fedora
 	ln -sf contrib/kimchi.spec.fedora kimchi.spec
diff --git a/configure.ac b/configure.ac
index e5e6441..2b71cf7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,26 @@ else
 AC_SUBST([ENABLE_SAMPLE], [False])
 fi
 
+AC_ARG_ENABLE(
+    [fonts],
+    [AS_HELP_STRING(
+        [--enable-fonts],
+        [Build fonts files in package @<:@default=no@:>@]
+    )],
+    ,
+    [enable_fonts="no"]
+)
+
+AM_CONDITIONAL([FONTS], [test "${enable_fonts}" = "yes"])
+
+if test "${enable_fonts}" = "yes"; then
+AC_SUBST([ONVNCFONTS], [ui/css/fonts/novnc/Makefile])
+AC_SUBST([UIFONTS], [ui/css/fonts/Makefile])
+else
+AC_SUBST([ONVNCFONTS], [''])
+AC_SUBST([UIFONTS], [])
+fi
+
 AC_CONFIG_FILES([
     po/Makefile.in
     po/gen-pot
@@ -86,8 +106,6 @@ AC_CONFIG_FILES([
     ui/Makefile
     ui/css/Makefile
     ui/css/novnc/Makefile
-    ui/css/fonts/Makefile
-    ui/css/fonts/novnc/Makefile
     ui/images/Makefile
     ui/images/theme-default/Makefile
     ui/js/Makefile
@@ -113,6 +131,8 @@ AC_CONFIG_FILES([
     tests/Makefile
     config/Makefile
     config/ui/Makefile
+    $UIFONTS
+    $ONVNCFONTS
 ],[
     chmod +x po/gen-pot
 ])
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 993fd6f..4e863f5 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -61,7 +61,7 @@ Web server application to manage KVM/Qemu virtual machines
 
 
 %build
-%configure
+%configure %{?with_fonts:--enable-fonts}
 make
 
 
@@ -154,8 +154,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/kimchi/doc/kimchi-templates.png
 %{_datadir}/kimchi/mo/*/LC_MESSAGES/kimchi.mo
 %{_datadir}/kimchi/config/ui/*.xml
+%if 0%{?with_fonts}
 %{_datadir}/kimchi/ui/css/fonts/fontawesome-webfont.*
 %{_datadir}/kimchi/ui/css/fonts/novnc/Orbitron700.*
+%endif
 %{_datadir}/kimchi/ui/css/novnc/base.css
 %{_datadir}/kimchi/ui/css/theme-default.min.css
 %{_datadir}/kimchi/ui/images/*.png
diff --git a/ui/css/Makefile.am b/ui/css/Makefile.am
index db65799..020f859 100644
--- a/ui/css/Makefile.am
+++ b/ui/css/Makefile.am
@@ -15,7 +15,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+if FONTS
 SUBDIRS = novnc fonts
+else
+SUBDIRS = novnc
+endif
 
 EXTRA_DIST = theme-default
 
-- 
1.9.3




More information about the Kimchi-devel mailing list