If PDF files are found in the _LICENSE_FILES variable, include them as
literal pages in license-report.pdf with the 'pdfpages' package, which
nowadays comes preinstalled with most LaTeX distributions.

Signed-off-by: Roland Hieber <r...@pengutronix.de>
---
* v1 -> v2: no changes

 scripts/lib/ptxd_make_license_report.sh |  2 ++
 scripts/lib/ptxd_make_world_license.sh  | 41 ++++++++++++++++---------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/scripts/lib/ptxd_make_license_report.sh 
b/scripts/lib/ptxd_make_license_report.sh
index c92dc725d1f7..bed5bd1d43c5 100644
--- a/scripts/lib/ptxd_make_license_report.sh
+++ b/scripts/lib/ptxd_make_license_report.sh
@@ -18,6 +18,7 @@ ptxd_make_license_report_header() {
        \usepackage{tikz}
        \usepackage{adjustbox}
        \usepackage{spverbatim}
+       \usepackage{pdfpages}
        \hypersetup{colorlinks=true,linkcolor=blue,urlcolor=blue}
 
        %% Something like this may be needed depending on the package list
@@ -209,6 +210,7 @@ ptxd_make_license_compliance_header() {
        \usepackage{tikz}
        \usepackage{adjustbox}
        \usepackage{spverbatim}
+       \usepackage{pdfpages}
        \hypersetup{colorlinks=true,linkcolor=blue,urlcolor=blue}
 
        %% Something like this may be needed depending on the package list
diff --git a/scripts/lib/ptxd_make_world_license.sh 
b/scripts/lib/ptxd_make_world_license.sh
index f68b75339cb2..785254603765 100644
--- a/scripts/lib/ptxd_make_world_license.sh
+++ b/scripts/lib/ptxd_make_world_license.sh
@@ -188,21 +188,32 @@ ptxd_make_world_license_write() {
            continue
        fi
        title="$(basename "${license}")"
-       cat <<- EOF
-               \section{$(ptxd_make_latex_escape "${title}")${guess}}
-               \begin{small}
-               \begin{spverbatim}
-       EOF
-       if [ -f "${license}.utf-8" ]; then
-           cat "${license}.utf-8"
-       else
-           cat "${license}"
-       fi | sed -e 's/\f/\n/g'
-       check_pipe_status || return
-       cat <<- EOF
-               \end{spverbatim}
-               \end{small}
-       EOF
+       case "${license}" in
+           *.pdf)
+               cat <<- EOF
+                       \section{$(ptxd_make_latex_escape "${title}")${guess}}
+                       \includepdf[pages=-]{${license}}
+               EOF
+               ;;
+           *)
+               cat <<- EOF
+                       \section{$(ptxd_make_latex_escape "${title}")${guess}}
+                       \begin{small}
+                       \begin{spverbatim}
+               EOF
+
+               if [ -f "${license}.utf-8" ]; then
+                   cat "${license}.utf-8"
+               else
+                   cat "${license}"
+               fi | sed -e 's/\f/\n/g'
+               check_pipe_status || return
+               cat <<- EOF
+                       \end{spverbatim}
+                       \end{small}
+               EOF
+               ;;
+       esac
     done
 }
 export -f ptxd_make_world_license_write
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to 
ptxdist-requ...@pengutronix.de

Reply via email to