Debian Codegraph @

README.compile

raw
1 Howto compile
2 =============
3
4 = Prerequisites
5
6 You need at least an installed:
7
8 * cmake
9 * make
10 * C- and C++-compiler
11 * and the pcre2-library
12
13 = Compiling under Linux
14
15 [bash]
16 ----
17 mkdir build
18 cd build
19 cmake ../src/
20 make
21 make package # optional, creates a Debian or Redhat package
22 make install # optional, installs binary locally
23 # with 'make help' you get additional targets
24 ----
25
26 Alternatively, you could use ninja:
27
28 [bash]
29 ----
30 mkdir build
31 cd build
32 cmake -G Ninja ../src/
33 cmake --build .
34 cmake --build . --target package # optional, creates a Debian or Redhat package
35 cmake --build . --target install # optional, creates a Debian or Redhat package
36 ----
37
38
39
40
41 [TIP]
42 ====
43 use "-fstack-check" if you expect highly corrupted TIFF-files
44 ====
45
46 == Support for strong ICC checks
47
48 If available, the ICCProfLib will be used to verify ICC profiles more deeply.
49 Anyway, the ICCProfLib reports warnings and errors. In default checkit_tiff compiles in relaxed mode, so all warnings are ignored.
50 This makes sense in most cases. To handle warnings as errors, checkit_tiff needs to be compiled with the 'WITH_STRONG_ICC' flag.
51
52 [bash]
53 ----
54 cmake ../src/ -DCMAKE_C_FLAGS="-DWITH_STRONG_ICC"
55 ----
56
57 If no ICCProfLib is available, checkit_tiff falls back into sa rudimentary ICC check.
58
59 See file link:README.icc[] for details.
60
61 To disable the use of ICC proflib, set CMAKE-flag "-DWITHOUT_ICC_PROFLIB=1"
62
63 == Support for outdated ICC variants
64
65 if you want to allow preferred CMM type "LINO", you should use the cmake-call
66
67 [bash]
68 ----
69 cmake ../src/ -DCMAKE_C_FLAGS="-DALLOW_CMMTYPE_LINO"
70 ----
71
72 if you want to allow outdated ICC.1:2001-04 version (2.4.0), you should use the cmake-call
73
74 [bash]
75 ----
76 cmake ../src/ -DCMAKE_C_FLAGS="-DALLOW_ICC1_2001_04"
77 ----
78
79 == cross compiling for Windows binaries
80
81 alternatively for windows crosscompiling using mingw
82 (see file FAQ for more detailed manual)
83
84 [bash]
85 ----
86 mkdir build
87 cd build
88 cmake -DCMAKE_TOOLCHAIN_FILE=../src/toolchain-mingw32.cmake -DPCRE2_POSIX_LIBRARY=~/Downloads/pcre2-10.40/.libs/libpcre2-posix.a -DPCRE2_LIBRARY=~/Downloads/pcre2-10.40/.libs/libpcre2-8.a -DPCRE2_INCLUDE_DIR=~/Downloads/pcre2-10.40/ ../src/
89 make
90 ----
91
92 == examples for specific compile flags
93
94 to change compiler or CFLAGS:
95
96 * 'cmake ../src/ -DCMAKE_C_COMPILER=$(which gcc)'
97 * 'cmake ../src/ -DCMAKE_C_FLAGS="-O0 -p -g"'
98 * 'cmake ../src/ -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_C_FLAGS="-Oz -pedantic"' -DCMAKE_CXX_FLAGS="-Oz"
99
100 example SANITIZE options
101
102 [bash]
103 .SANITIZE with clang++
104 ----
105 cmake ../src/ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_C_FLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer"
106 make
107 ASAN_OPTIONS=detect_leaks=1 ./checkit_tiff ...
108 ----
109
110 [bash]
111 .SANITIZE with gcc
112 ----
113 cmake ../src/ -DCMAKE_C_FLAGS="-Og -g -fsanitize=address -fsanitize=undefined -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=null -fsanitize=return -fsanitize=signed-integer-overflow-fno-omit-frame-pointer"
114 ASAN_OPTIONS=detect_leaks=1 ./checkit_tiff ...
115 ----
116
117
118 [bash]
119 .compile a static binary
120 ----
121 cmake ../src/ -DSTATIC=1
122 ----
123
124 [bash]
125 .compile with MUSL
126 ----
127 cmake ../src/ \
128 -G "Ninja" \
129 -DCMAKE_CXX_COMPILER="g++" \
130 -DCMAKE_C_COMPILER="musl-gcc" \
131 -DCMAKE_C_FLAGS="-DALLOW_ICC1_2001_04" \
132 -DSTATIC=1 \
133 -DWITHOUT_ICC_PROFLIB=1 \
134 -DPCRE2_LIBRARY=pcre2-10.40/.libs/ \
135 -DPCRE2_POSIX_LIBRARY=pcre2-10.40/.libs/libpcre2-posix.a \
136 -DPCRE2_LIBRARY=pcre2-10.40/.libs/libpcre2-8.a \
137 -DPCRE2_INCLUDE_DIR=pcre2-10.40/src \
138 -DPCRE2_STATIC=1 \
139 ../src/
140 ----
141
142 For MUSL you need a MUSL precompiled pcre2-library.
143
144 [bash]
145 .use clang-tidy
146 ----
147 cmake ../src/ -DCMAKE_C_CLANG_TIDY:STRING="clang-tidy-16;-checks=-*,readability-*" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCMAKE_C_COMPILER=/usr/bin/clang-16 -DCMAKE_C_FLAGS="-O0 -g -fno-omit-frame-pointer"
148 make
149 run-clang-tidy-16.py -clang-tidy-binary /usr/bin/clang-tidy-16
150 ----
151 [NOTE]
152 ====
153 Most compiler flags are not of interest to the standard user, since they are only needed for debugging purposes or for very specific build environments, or are set automatically.
154
155 However, here is a list of the most important flags:
156
157 * ALLOW_CMMTYPE_LINO
158 * ALLOW_ICC1_2001_04
159 * COMPAT_NEED_REALLOCARRAY
160 * HAVE_IccProfLib
161 * HAVE_MMAP
162 * HAVE_MUNMAP
163 * HAVE_STRNDUP
164 * PCRE2_STATIC
165 * WITH_STRONG_ICC
166 * WITHOUT_ICC_PROFLIB
167 ====
168
169 == Testing
170
171 you need perl with Test::More
172
173 * change to directory 't/'
174 * run 'perl -I ./ *.t'
175
176 Alternatively: run 'make test'
177