From a179a1a826d8eae3f0f900fda52dc47f39f2f84e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 2 Oct 2025 16:27:52 -0700 Subject: [PATCH] install: add option for installing .pdf.xz; fix RPMs - Add an option to use "make install" to install .pdf.xz - Fix RPM spec file to put the documentation in doc/nasm instead of doc/nasm-doc. - RPM doesn't like unversioned Obsoletes; set a valid cutoff. - Make nasm-doc depend on nasm. - Add zlib-devel as a build dependency. - Add EXTRA_CFLAGS and EXTRA_LDFLAGS for some automated platforms. Signed-off-by: H. Peter Anvin (Intel) --- Makefile.in | 6 ++++-- doc/Makefile.in | 21 ++++++++++++++++----- nasm.spec.in | 11 ++++++++--- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index f2a2e6357..f3fba9db0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -37,9 +37,11 @@ INTERNAL_CFLAGS = -I$(srcdir) -I$(objdir) \ -I$(srcdir)/disasm -I$(objdir)/disasm \ -I$(srcdir)/output -I$(objdir)/output \ $(ZLIBINC) -ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) +EXTRA_CFLAGS = +ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) $(EXTRA_CFLAGS) LDFLAGS = @LDFLAGS@ -ALL_LDFLAGS = $(ALL_CFLAGS) $(LDFLAGS) +EXTRA_LDFLAGS = +ALL_LDFLAGS = $(ALL_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) LIBS = @LIBS@ ZLIB = @ZLIB@ diff --git a/doc/Makefile.in b/doc/Makefile.in index 5743ab792..fa4bd84ea 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -65,6 +65,9 @@ ALLSRCS = $(SRCS) $(GENSRC) OUT = html nasmdoc.txt nasmdoc.pdf $(XZFILES) XZOUT = nasmdoc.pdf.xz +# Use "make install PDFZ=.xz" to install pdf.xz +PDF = + # Don't delete intermediate files .SECONDARY: @@ -83,14 +86,17 @@ xzfiles: $(XZOUT) insns.src: inslist.pl ../x86/insns.xda $(RUNPERL) $^ $@ +# A representative HTML file +htmltarget=html/nasm00.html + html: $(HTMLAUX) $(MKDIR_P) html for f in $(HTMLAUX); do $(CP_UF) "$(srcdir)/$$f" html/; done - $(MAKE) html/nasmdoc0.html + $(MAKE) $(htmltarget) RDSRC = $(RUNPERL) $(srcdir)/rdsrc.pl -I$(srcdir) -M$(@F).dep -html/nasmdoc0.html: $(ALLSRCS) rdsrc.pl +$(htmltarget): $(ALLSRCS) rdsrc.pl $(RM_F) html/*.html $(RDSRC) -ohtml html $< @@ -140,10 +146,15 @@ spotless: clean -$(RM_RF) html info -$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.pdf.xz *.dvi -install: all - $(MKDIR_P) $(DESTDIR)$(htmldir) $(DESTDIR)$(pdfdir) +install_html: html + $(MKDIR_P) $(DESTDIR)$(htmldir) $(INSTALL_DATA) html/* $(DESTDIR)$(htmldir) - $(INSTALL_DATA) nasmdoc.pdf $(DESTDIR)$(pdfdir) + +install_pdf: nasmdoc.pdf$(Z) + $(MKDIR_P) $(DESTDIR)$(pdfdir) + $(INSTALL_DATA) nasmdoc.pdf$(Z) $(DESTDIR)$(pdfdir) + +install: install_html install_pdf # # Dummy rules that changes make behavior diff --git a/nasm.spec.in b/nasm.spec.in index 34ce7f013..ccad85193 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -22,8 +22,9 @@ BuildRequires: gcc BuildRequires: make BuildRequires: gzip BuildRequires: xz +BuildRequires: zlib-devel BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Obsoletes: %{name}-rdoff +Obsoletes: %{name}-rdoff < 2.16 %package doc Summary: Detailed manual for the Netwide Assembler @@ -32,9 +33,11 @@ BuildRequires: ghostscript BuildRequires: fontconfig BuildRequires: google-roboto-fonts BuildRequires: google-roboto-mono-fonts +Requires: %{name} = %{version}-%{release} %define _pkgdatadir %{_datadir}/%{name} %define pkgdatadir %{?buildroot:%{buildroot}}%{_datadir}/%{name} +%define _pkgdocdir %{_docdir}/%{name} %description NASM is the Netwide Assembler, a free portable assembler for the Intel @@ -55,7 +58,7 @@ make %{?_smp_mflags} everything %install rm -rf "%{buildroot}" -make DESTDIR="%{buildroot}" install install_editors +make DESTDIR="%{buildroot}" PDFZ=".xz" install_everything gzip -9 "%{pkgdatadir}"/nasmtok.* %files @@ -71,7 +74,9 @@ gzip -9 "%{pkgdatadir}"/nasmtok.* %files doc %defattr(-,root,root) -%doc doc/html doc/nasmdoc.pdf.xz +%doc %{_pkgdocdir}/nasmdoc.pdf.xz +%dir %{_pkgdocdir}/html +%doc %{_pkgdocdir}/html/* # This is the upstream spec file; the change log is in git %changelog