summaryrefslogtreecommitdiffstats
path: root/common/latex/ifplatform.sty
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-11-06 12:02:47 +1100
committerChris Johns <chrisj@rtems.org>2016-11-06 12:02:47 +1100
commit8330198edc3ec08021f358c3030266194278c5a2 (patch)
treedfab1a147e46f0bc95abfd1d75863da52c1c4e15 /common/latex/ifplatform.sty
parentwaf: note about tex noise when running configure. (diff)
downloadrtems-docs-8330198edc3ec08021f358c3030266194278c5a2.tar.bz2
waf: Add support to handle missing Latex packages on hosts they are not available on.
It appears the support for texlive packages on some hosts is variable. This patch lets us add missing packages to our source tree so a PDF can be built on those hosts. The quality of the PDFs created may vary as some short cuts may have been take. For example lato is a font and only the sty file as been added and not the actual font which means it's use will default to another font.
Diffstat (limited to 'common/latex/ifplatform.sty')
-rw-r--r--common/latex/ifplatform.sty151
1 files changed, 151 insertions, 0 deletions
diff --git a/common/latex/ifplatform.sty b/common/latex/ifplatform.sty
new file mode 100644
index 0000000..7f59f61
--- /dev/null
+++ b/common/latex/ifplatform.sty
@@ -0,0 +1,151 @@
+%%
+%% This is file `ifplatform.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ifplatform.dtx (with options: `package')
+%% ________________________________________________________
+%% Copyright (C) 2007-2010 Will Robertson & Johannes Große
+%% License information appended.
+\ProvidesPackage{ifplatform}
+ [2010/10/22 v0.4 Testing for the operating system]
+\RequirePackage{pdftexcmds,catchfile,ifluatex}
+\newif\ifshellescape
+\newif\ifwindows
+\newif\ifmacosx
+\newif\iflinux
+\newif\ifcygwin
+\newcommand\windowsname{Windows}
+\newcommand\notwindowsname{*NIX}
+\newcommand\linuxname{Linux}
+\newcommand\macosxname{Mac\,OS\,X}
+\newcommand\cygwinname{Cygwin}
+\newcommand\unknownplatform{[Unknown]}
+\edef\ip@file{\jobname.w18}
+\newif\if@ip@nix@
+\ifnum\pdf@shellescape=1\relax
+ \shellescapetrue
+\else
+ \ifluatex\else
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ shell escape is disabled,
+ so I can only detect \@backslashchar ifwindows%
+ }
+ \fi
+\fi
+\def\ip@cantdecide{%
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ I can't tell if this is Windows or *nix;
+ you appear to be both%
+ }%
+}
+\ifluatex
+ \csname\directlua{
+ if os.type == "unix" then
+ tex.sprint("@ip@nix@true")
+ elseif os.type == "windows" then
+ tex.sprint("windowstrue")
+ end
+ }\endcsname
+\else
+\IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
+\IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
+\edef\ip@windows@echo@test{echo \string# > "\ip@file"}
+\def\ip@backupplan{%
+ \IfFileExists{\ip@file}{%
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ Please delete the file "\ip@file" and try again%
+ }%
+ \ip@cantdecide
+ }{%
+ \immediate\write18{\ip@windows@echo@test}%
+ \IfFileExists{\ip@file}{%
+ \immediate\write18{del "\ip@file"}%
+ \windowstrue
+ }{%
+ \@ip@nix@true
+ }%
+ }%
+}
+\ifwindows
+ \if@ip@nix@
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ I can't tell if this is Windows or *nix;
+ you appear to be neither%
+ }
+ \fi
+\else
+ \if@ip@nix@\else
+ \ifshellescape
+ \ip@backupplan
+ \else
+ \ip@cantdecide
+ \fi
+ \fi
+\fi
+\fi
+\def\ip@only@six#1#2#3#4#5#6#7\@nil{#1#2#3#4#5#6}
+\if@ip@nix@
+\ifshellescape
+ \ifwindows\else
+ \immediate\write18{uname -s > "\ip@file"}
+ \CatchFileDef\@tempa{\ip@file}{}
+ \immediate\write18{rm -- "\ip@file"}
+ \edef\@tempa{\expandafter\zap@space\@tempa\@empty}
+ \def\@tempb{Linux}
+ \ifx\@tempa\@tempb
+ \linuxtrue
+ \else
+ \def\@tempb{Darwin}
+ \ifx\@tempa\@tempb
+ \macosxtrue
+ \else
+ \def\@tempb{CYGWIN}
+ \edef\@tempc{\expandafter\ip@only@six\@tempa------\@nil}
+ \ifx\@tempb\@tempc
+ \cygwintrue
+ \else
+ \edef\unknownplatform{\@tempa}
+ \fi
+ \fi
+ \fi
+ \fi
+\fi\fi
+\edef\platformname{%
+ \ifwindows
+ \noexpand\windowsname
+ \else
+ \ifshellescape
+ \iflinux
+ \noexpand\linuxname
+ \else
+ \ifmacosx
+ \noexpand\macosxname
+ \else
+ \ifcygwin
+ \noexpand\cygwinname
+ \else
+ \noexpand\unknownplatform
+ \fi
+ \fi
+ \fi
+ \else
+ \noexpand\notwindowsname
+ \fi
+ \fi
+}
+%% Copyright (C) 2007-2010 by Will Robertson & Johannes Große
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "author-maintained" by Will Robertson.
+%%
+%% This work consists of the file ifplatform.dtx
+%% and the derived files ifplatform.pdf,
+%% ifplatform.sty, and
+%% ifplatform.ins.
+%%
+%% End of file `ifplatform.sty'.