Avoid hard-coding libjpeg header paths

Rely on include_dirs as configured in
third_party/libjpeg{-turbo}/BUILD.gn instead, similar to other Chromium
libjpeg clients (e.g. [1], [2]).

This should facilitate rolling libjpeg-turbo 3.1.0, which changes the
header location [3].

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/iccjpeg/iccjpeg.h;l=25
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/test/testsupport/jpeg_frame_writer.cc;l=19
[3] https://crrev.com/c/chromium/deps/libjpeg_turbo/+/6264683

Change-Id: I5e7c3bfb750c4572347af95f1e5d62ca968cee7e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129050
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Thomas Sepez <tsepez@google.com>
diff --git a/core/fxcodec/jpeg/jpeg_common.h b/core/fxcodec/jpeg/jpeg_common.h
index 5b6cdee..b82ea60 100644
--- a/core/fxcodec/jpeg/jpeg_common.h
+++ b/core/fxcodec/jpeg/jpeg_common.h
@@ -28,12 +28,9 @@
 #if defined(USE_SYSTEM_LIBJPEG)
 #include <jerror.h>
 #include <jpeglib.h>
-#elif defined(USE_LIBJPEG_TURBO)
-#include "third_party/libjpeg_turbo/jerror.h"
-#include "third_party/libjpeg_turbo/jpeglib.h"
 #else
-#include "third_party/libjpeg/jerror.h"
-#include "third_party/libjpeg/jpeglib.h"
+#include "jerror.h"   // NOLINT(build/include_directory)
+#include "jpeglib.h"  // NOLINT(build/include_directory)
 #endif
 
 struct JpegCommon {
diff --git a/third_party/libtiff/0000-build-config.patch b/third_party/libtiff/0000-build-config.patch
index 4312834..bcf5dc1 100644
--- a/third_party/libtiff/0000-build-config.patch
+++ b/third_party/libtiff/0000-build-config.patch
@@ -13,21 +13,16 @@
 diff a/third_party/libtiff/tif_jpeg.c b/third_party/libtiff/tif_jpeg.c
 --- a/third_party/libtiff/tif_jpeg.c
 +++ b/third_party/libtiff/tif_jpeg.c
-@@ -110,8 +110,16 @@
+@@ -110,8 +110,13 @@
  #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
  #endif
  
--#include "jerror.h"
--#include "jpeglib.h"
 +#if defined(USE_SYSTEM_LIBJPEG)
 +#include <jerror.h>
 +#include <jpeglib.h>
-+#elif defined(USE_LIBJPEG_TURBO)
-+#include "third_party/libjpeg_turbo/jerror.h"
-+#include "third_party/libjpeg_turbo/jpeglib.h"
 +#else
-+#include "third_party/libjpeg/jerror.h"
-+#include "third_party/libjpeg/jpeglib.h"
+ #include "jerror.h"
+ #include "jpeglib.h"
 +#endif
  
  /* Do optional compile-time version check */
diff --git a/third_party/libtiff/tif_jpeg.c b/third_party/libtiff/tif_jpeg.c
index 8eb2f74..0596e40 100644
--- a/third_party/libtiff/tif_jpeg.c
+++ b/third_party/libtiff/tif_jpeg.c
@@ -76,12 +76,9 @@
 #if defined(USE_SYSTEM_LIBJPEG)
 #include <jerror.h>
 #include <jpeglib.h>
-#elif defined(USE_LIBJPEG_TURBO)
-#include "third_party/libjpeg_turbo/jerror.h"
-#include "third_party/libjpeg_turbo/jpeglib.h"
 #else
-#include "third_party/libjpeg/jerror.h"
-#include "third_party/libjpeg/jpeglib.h"
+#include "jerror.h"
+#include "jpeglib.h"
 #endif
 
 /* Do optional compile-time version check */