-
Notifications
You must be signed in to change notification settings - Fork 1
/
poppler_compile.sh
executable file
·92 lines (85 loc) · 2.69 KB
/
poppler_compile.sh
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
#!/bin/bash
POPPLER=0.76.1
rm -rf poppler-$POPPLER*
curl -O https://poppler.freedesktop.org/poppler-$POPPLER.tar.xz
tar -xf poppler-$POPPLER.tar.xz
# Patch the CMakeLists.txt to do as mutch of a static compile as possible
patch poppler-$POPPLER/CMakeLists.txt<<'EOF'
--- poppler-$POPPLER/CMakeLists.txt 2018-12-07 03:22:06.000000000 +1100
+++ poppler-$POPPLER_build/CMakeLists.txt 2019-01-06 13:51:15.000000000 +1100
@@ -396,7 +396,8 @@
poppler/Movie.cc
poppler/Rendition.cc
)
-set(poppler_LIBS ${FREETYPE_LIBRARIES})
+#set(poppler_LIBS ${FREETYPE_LIBRARIES})
+set(poppler_LIBS /usr/local/lib/libfreetype.a bz2 expat /usr/local/lib/libpng.a)
if(ENABLE_SPLASH)
set(poppler_SRCS ${poppler_SRCS}
poppler/SplashOutputDev.cc
@@ -419,14 +420,16 @@
)
endif()
if(FONTCONFIG_FOUND)
- set(poppler_LIBS ${poppler_LIBS} ${FONTCONFIG_LIBRARIES})
+ #set(poppler_LIBS ${poppler_LIBS} ${FONTCONFIG_LIBRARIES})
+ set(poppler_LIBS ${poppler_LIBS} /usr/local/lib/libfontconfig.a)
endif()
if(JPEG_FOUND)
set(poppler_SRCS ${poppler_SRCS}
poppler/DCTStream.cc
)
- set(poppler_LIBS ${poppler_LIBS} ${JPEG_LIBRARIES})
+ #set(poppler_LIBS ${poppler_LIBS} ${JPEG_LIBRARIES})
+ set(poppler_LIBS ${poppler_LIBS} /usr/local/lib/libjpeg.a)
endif()
if(ENABLE_ZLIB)
set(poppler_SRCS ${poppler_SRCS}
@@ -456,7 +459,7 @@
set(poppler_SRCS ${poppler_SRCS}
poppler/JPEG2000Stream.cc
)
- set(poppler_LIBS ${poppler_LIBS} openjp2)
+ set(poppler_LIBS ${poppler_LIBS} /usr/local/lib/libopenjp2.a)
else ()
set(poppler_SRCS ${poppler_SRCS}
poppler/JPXStream.cc
@@ -472,10 +475,12 @@
set(poppler_LIBS ${poppler_LIBS} gdi32)
endif()
if(PNG_FOUND)
- set(poppler_LIBS ${poppler_LIBS} ${PNG_LIBRARIES})
+ #set(poppler_LIBS ${poppler_LIBS} ${PNG_LIBRARIES})
+ set(poppler_LIBS ${poppler_LIBS} /usr/local/lib/libpng.a)
endif()
if(TIFF_FOUND)
- set(poppler_LIBS ${poppler_LIBS} ${TIFF_LIBRARIES})
+ #set(poppler_LIBS ${poppler_LIBS} ${TIFF_LIBRARIES})
+ set(poppler_LIBS ${poppler_LIBS} /usr/local/lib/libtiff.a)
endif()
if(MSVC)
EOF
cd poppler-$POPPLER
# Prepare Build, most of this from hombrew/Formulas/poppler.rb
mkdir build
cd build
/usr/local/bin/cmake .. \
-DBUILD_GTK_TESTS=OFF \
-DENABLE_CMS=none \
-DENABLE_GLIB=OFF \
-DENABLE_QT5=OFF \
-DENABLE_XPDF_HEADERS=ON \
-DWITH_GObjectIntrospection=ON \
-DBUILD_SHARED_LIBS=OFF # Make libpoppler a static library
# -DENABLE_LIBOPENJPEG=none \
# Make pdftotext
make pdftotext
# Check what libraries are dynamically linked, want no /usr/local's
otool -L utils/pdftotext
echo "Check there are no /usr/local libraries linked"
# Clean up
mv utils/pdftotext ../..
cd ../..
rm -rf poppler-$POPPLER*
# Open Platypus
open -a "Platypus.app" "PDF to Text.platypus"