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) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2025-10-02 16:27:52 -07:00
parent 7415a1e5f8
commit a179a1a826
3 changed files with 28 additions and 10 deletions

View file

@ -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@

View file

@ -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

View file

@ -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