diff --git a/README b/README index 90a1c5830f247cfe0e07143bf3b7c1958ede3834..7182866d58a128f7c44a39de75e7ca7cc70253c7 100644 --- a/README +++ b/README @@ -1,72 +1,75 @@ Beginnings of a PDF parser in Hammer ==================================== - - Currently needs a custom Hammer branch. You'll need to build against this: + - Needs a recent Hammer build: - https://gitlab.special-circumstanc.es/pesco/hammer/tree/pdf + https://gitlab.special-circumstanc.es/hammer/hammer/ - For detailed build instructions, see README.md in that repository. - - - Help the default Makefile find Hammer - - $ ln -s ../hammer/src hammer # needed for building pdf, include files - $ ln -s ../hammer/build/opt/src lib # needed for running pdf, to locate libhammer.so - - - Notes for 2020-04-27 release: - - The release branch has been tested to build with the 2020-04-27_RELEASE` branch located at https://gitlab.special-circumstanc.es/pesco/hammer/tree/2020-04-27_RELEASE + For detailed build/install instructions, see README.md in that repository. - Build environment: - pdf, if successfully extracting text, creates two output files per input file. These have the ".psectxt" and ".strtxt" extension with the file name of the input file. The compile-time variable KUDU_OUTDIR controls the default output folder. - If this variable is unset, the output files will be put in the "/tmp/" folder. To select another folder, add -DKUDU_OUTDIR="/path/to/output/folder" to CFLAGS in the Makefile. + + pdf, if successfully extracting text, creates two output files per input + file. These have the ".psectxt" and ".strtxt" extension with the file name + of the input file. The compile-time variable KUDU_OUTDIR controls the + default output folder. If this variable is unset, the output files will be + put in the "/tmp/" folder. To select another folder, add + -DKUDU_OUTDIR="/path/to/output/folder" to CFLAGS. - Build: - $ pushd ../hammer; scons; popd # build Hammer - $ make pdf + $ make - Usage: - $ export LD_LIBRARY_PATH=./lib # see Troubleshooting section below to see if this is needed - $ ldd ./pdf | grep libhammer # verify that libhammer.so was found $ ./pdf <filename> # place some test files in the t/ directory... $ make test - # There are two optional parameters to specify strictness of the parser, and the lowest severity violation to output to stderr: + There are two optional parameters to specify strictness of the parser, and + the lowest severity violation to output to stderr: + $ ./pdf <filename> 0 9 - # At the time of writing, severity ratings of VIOL()s range between 1-9 - # To silence (almost) all error messages, pass a number equal to or greater than 99999 as the fourth parameter: + + At the time of writing, severity ratings of VIOL()s range between 1-9. + To silence (almost) all error messages, pass a number equal to or greater + than 99999 as the fourth parameter: + $ ./pdf <filename> 0 99999 - Troubleshooting: - libhammer.so not found: + - <hammer/hammer.h> or libhammer.so not found: - If Hammer is not installed as a system library, ld may fail to locate libhammer.so. The quick fix for this is altering LD_LIBRARY_PATH before running pdf: + If Hammer is not installed as a system library or in a nonstandard + location, cc and ld will fail to locate its headers and library. The + quick fix for this is to create symlinks called 'hammer' and 'lib' + pointing to Hammer's source and build output directories, respectively: - $ export LD_LIBRARY_PATH=./lib - $ make test + $ ln -s ../hammer/src hammer + $ ln -s ../hammer/build/opt/src lib + $ make - The second solution is executing "scons install" when building Hammer, which will install it in ld's usual search path: + Likewise, when running 'pdf' directly, ld.so will fail to locate + libhammer.so. The quick fix is to point LD_LIBRARY_PATH to the 'lib' dir: - $ pushd ../hammer; scons install; popd - # ... Update ldconfig cache if needed - $ make pdf - $ make test + $ export LD_LIBRARY_PATH=$PWD/lib + $ ./pdf <filename> - Evaluating test results: - For every file in the t/ directory, the pdf parser is executed. On successful parse, a message of the following form is displayed: + For every file in the t/ directory, the pdf parser is executed. On + successful parse, a message of the following form is displayed: - OK: t/<filename> + OK: t/<filename> - In case of a non-fatal parse error, error messages may be displayed, but presence of the "OK" indicates pdf exited successfully. On a failed test run, only parse error messages are displayed. + In case of a non-fatal parse error, error messages may be displayed, but + presence of the "OK" indicates pdf exited successfully. On a failed test + run, only parse error messages are displayed. - Copyright: Various authors. Released under the terms of the ISC license. See LICENSE for full copyright and licensing notice. -