/usr/bin/epix is in epix 1.2.14-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | #! /bin/bash
#
# epix: wrapper script for ePiX
#
# Options: --help for usage, --version for version and license
#
# Compiler flags may be specified on the command line or in the config
# file ~/.epixrc. The script attempts to deal intelligently with missing
# or multiple extensions. If the input file has a recognized extension,
# there's no issue. If only the root name <infile> is given, the script
# searches for completions in the order of preference dictated by the
# variable EPIX_EXTENSIONS. A warning is issued for multiple matches.
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Andrew D. Hwang <For address, do "epix -V">
#
. "/usr/share/epix/epix-lib.sh"
EPIX_CONFIG_FILE="$HOME/.epixrc"
# Search these extensions in order of preference
EPIX_EXTENSIONS="xp flx cc c C cpp" # or NULL
EPIX_DOT_EXT=".${EPIX_EXTENSIONS// /|.}" # for usage message
# Default inc/lib directories and compiler
DEFAULT_INC="-I/usr/include"
DEFAULT_LIB="-L/usr/lib/x86_64-linux-gnu/epix"
COMPILER="/usr/bin/g++"
# Use default library unless we're called by version number
LIBS="-lm"
POSTLIBS="-lepix"
EPIX_SRC_EXT=cc
declare EPIX_MYINCLUDES
declare EPIX_MYLIBDIRS
declare EPIX_MYLIBS
declare EPIX_MYWARNS
declare EPIX_MYFLAGS
declare -a EPIX_FILE_LIST
declare -a TEMPFILES
trap '[ -n "${TEMPFILES[*]}" ] && rm -f "${TEMPFILES[@]}"' 0 1 2 3 7 10 13 15
function epix_help()
{
cat <<"HELP"
Options:
-h, --help
Show this message and exit
-V, --version
Show version and exit
-v, --verbose
Show success/failure messages
--gpl
Show license
-o, --output
Specify output file name (ONLY for use with a single input file)
--pst
Write output file using PSTricks macros
--tikz
Write output file using tikz macros
--eepic
Write output file using eepic macros
-I<include>
Append include directory
-L<library>
Append library directory
-l<lib>
Link against lib
--no-defaults
Do not use default include/library directories or libraries
-cc, --compiler)
Specify the compiler (e.g., gcc)
All other options are passed to the compiler. Valid options,
one per line, may be placed in $HOME/.epixrc.
HELP
ePiX_bugreport
} # End of epix_help
# Parse command line/config file for compiler flags/options
function epix_parse_options {
while [ "$1" != "${1#-}" ]; do
case "$1" in
-I)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_MYINCLUDES="$EPIX_MYINCLUDES -I$2"; shift 2; continue
;;
-L)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_MYLIBDIRS="$EPIX_MYLIBDIRS -L$2"; shift 2; continue
;;
-l)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_MYLIBS="$EPIX_MYLIBS -l$2"; shift 2; continue
;;
-W)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_MYWARNS="$EPIX_MYWARNS -W$2"; shift 2; continue
;;
-I*)
EPIX_MYINCLUDES="$EPIX_MYINCLUDES $1"; shift; continue
;;
-L*)
EPIX_MYLIBDIRS="$EPIX_MYLIBDIRS $1"; shift; continue
;;
-l*)
EPIX_MYLIBS="$EPIX_MYLIBS $1"; shift; continue
;;
-W*)
EPIX_MYWARNS="$EPIX_MYWARNS $1"; shift; continue
;;
-i*|-u|-x)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_MYFLAGS="$EPIX_MYFLAGS $1 $2"; shift 2; continue
;;
-b)
ePiX_warn "Skipping option \"$1 $2\""
shift 2; continue
;;
-o|--output)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
EPIX_OUTFILE="$2"
EPIX_OUTROOT="${EPIX_OUTFILE%%.eepic}"
shift 2; continue
;;
--pst)
EPIX_MYFLAGS="$EPIX_MYFLAGS -DEPIX_FMT_PSTRICKS"
shift; continue
;;
--tikz)
EPIX_MYFLAGS="$EPIX_MYFLAGS -DEPIX_FMT_TIKZ"
shift; continue
;;
--eepic)
EPIX_MYFLAGS="$EPIX_MYFLAGS -DEPIX_FMT_EEPIC"
shift; continue
;;
# Deliberately undocumented
-q|--quiet)
QUIET=1
shift; continue
;;
-v|--verbose)
if [ -z "$2" ]; then
echo "Please use -V for version"
exit 0
fi
QUIET=0
shift; continue
;;
-vv)
echo "Discontinued option -vv; please use -v for verbose output"
exit 0
;;
-h|--help)
ePiX_usage epix $EPIX_DOT_EXT
epix_help
exit 0
;;
-V|--version|--gpl)
ePiX_version epix
ePiX_license
exit 0
;;
--no-defaults)
POSTLIBS=
DEFAULT_INC=
DEFAULT_LIB=
shift; continue
;;
-cc|--compiler)
if [ $# -lt 2 ]; then ePiX_die "Missing argument to \"$1\" option"; fi
COMPILER=$2
COMP_NAME=$(basename "$COMPILER")
if [ "${COMP_NAME: -2}" = cc ]; then EPIX_SRC_EXT=c; fi
shift 2; continue
;;
*)
EPIX_MYFLAGS="$EPIX_MYFLAGS $1"; shift; continue
;;
esac
done
# Assume remaining parameters are input files
EPIX_FILE_LIST=("$@")
} # End of epix_parse_options
# Compile specified files to eepic
function epix_compile_files {
if [ -z "$1" ]; then
ePiX_die "No input file specified"
fi
mkdir "$EPIX_TEMPDIR" || ePiX_die "Can't create \"${EPIX_TEMPDIR}\""
# file counts
local processed=0
local success=0
local failure=0
for EPIX_INFILE in "${EPIX_FILE_LIST[@]}"; do
# sets EPIX_INROOT, EPIX_SUFFIX, EPIX_NOTFOUND, touches EPIX_LOGFILE
epix_parse_filename "$EPIX_INFILE" "$EPIX_EXTENSIONS"
let processed=processed+1
if [ "$EPIX_NOTFOUND" = "yes" ]; then ePiX_fail && continue; fi
: ${EPIX_OUTROOT:=$EPIX_INROOT}
EPIX_OUTFILE="$EPIX_OUTROOT".eepic
# use .exe suffix for Cygwin
{ TEMP_BIN="$EPIX_INROOT".exe &&
touch "${EPIX_TEMPDIR}/$TEMP_BIN" &&
TEMPFILES=("{TEMPFILES[@]}" "${EPIX_TEMPDIR}/$TEMP_BIN") ; } ||
{ ePiX_fail "Couldn't create \"$EPIX_TEMPDIR/$TEMP_BIN\"" && continue;}
# Create symlink to input file with appropriate extension for compiler
TEMP_INPUT="${TEMP_BIN}-tmp.$EPIX_SRC_EXT"
TEMPFILES=("{TEMPFILES[@]}" "${EPIX_TEMPDIR}/$TEMP_INPUT")
# "cp -p" instead of "ln -s" for, e.g., vfat
{ cd ${EPIX_TEMPDIR} && \
cp -p "../$EPIX_INFILE" "$TEMP_INPUT" && cd .. ; } ||
{ ePiX_fail "Couldn't create \"${EPIX_TEMPDIR}/$TEMP_INPUT\"" && \
continue; }
# Log message, and compile executable
TMP_CMD=($COMPILER "${EPIX_TEMPDIR}/${TEMP_INPUT}" $EPIX_MYWARNS \
-o "${EPIX_TEMPDIR}/${TEMP_BIN}" \
$EPIX_MYFLAGS $EPIX_MYINCLUDES $DEFAULT_INC $EPIX_MYLIBDIRS \
$DEFAULT_LIB $LIBS $EPIX_MYLIBS $POSTLIBS)
ePiX_command "${TMP_CMD[@]}"
# Write eepic file
if [ -x "$EPIX_TEMPDIR/$TEMP_BIN" ]; then
echo "%% Generated from $EPIX_INFILE on $(date) by" \
> "$EPIX_OUTFILE"
ePiX_msg "Writing eepic file: ./$EPIX_TEMPDIR/$TEMP_BIN > $EPIX_OUTFILE"
./$EPIX_TEMPDIR/"$TEMP_BIN" >> "$EPIX_OUTFILE"
if [ $? -ne 0 ]; then
ePiX_warn "Could not create $EPIX_OUTFILE"
let failure=failure+1
else
let success=success+1
fi
else
ePiX_warn "Compilation of $EPIX_INFILE failed"
let failure=failure+1
fi
# Clean up; for multiple input files, clear output name
rm -f "$EPIX_TEMPDIR/$TEMP_BIN" "$EPIX_TEMPDIR/$TEMP_INPUT"
if [ "$EPIX_OUTROOT" = "$EPIX_INROOT" ]; then unset EPIX_OUTROOT; fi
ePiX_echo -e "\nTranscript written on $EPIX_LOGFILE"
done # for EPIX_INFILE in $INFILE_LIST
if [ $processed -gt 1 ]; then
if [ "$QUIET" -eq 0 ];
then
echo "$processed files processed: $success successfully, $failure failed" > "$EPIX_STDERR"
fi
fi
if [ -d "$EPIX_TEMPDIR" ]; then rm -Rf "$EPIX_TEMPDIR"; fi
} # end of epix_compile_files
## Script proper starts here ##
if [ $# -eq 0 ]; then
ePiX_usage epix $EPIX_DOT_EXT
epix_help
exit 0
fi
# Read options from the config file, if any
if [ -f "$EPIX_CONFIG_FILE" ]; then
epix_parse_options $(cat $EPIX_CONFIG_FILE | grep -v "#")
fi
# Command line options override config file options
epix_parse_options "$@"
# Suppress all warnings if none are requested
if [ "$EPIX_MYWARNS" = "" ]; then EPIX_MYWARNS="-w"; fi
# Remaining option(s) assumed to be input file(s)
epix_compile_files "${EPIX_FILE_LIST[@]}"
exit 0
|