<commit_before>require "mkmf"
require 'rbconfig'

LIB_DIRS = [
  "/usr/local/lib/pdfium"
]
HEADER_DIRS = [
  "/usr/local/include/pdfium/fpdfsdk/include"
]

LIBS=%w{pdfium bigint freetype fpdfdoc fpdftext formfiller
javascript v8_base v8_libbase v8_snapshot v8_libplatform jsapi
icui18n icuuc icudata pdfwindow fxedit fxcodec fxcrt fpdfdoc fpdfapi fdrm
fxge freetype pthread }

dir_config("libs", HEADER_DIRS, LIB_DIRS)

LIBS.each do | lib |
  have_library(lib) or abort "Didn't find library lib#{lib}"
end

if `uname`.chomp == 'Darwin' then

  FRAMEWORKS = %w{AppKit CoreFoundation}

  $LDFLAGS << FRAMEWORKS.map { |f| " -framework #{f}" }.join
end


create_makefile "pdfium_ext"<commit_msg>Changes needed to build on Linux<commit_after>require "mkmf"
require 'rbconfig'

LIB_DIRS = [
  "/usr/local/lib/pdfium",
  "/usr/lib/pdfium"
]
HEADER_DIRS = [
  "/usr/include/pdfium",
  "/usr/local/include/pdfium/fpdfsdk/include"
]
have_library('pthread')
have_library('objc') if RUBY_PLATFORM =~ /darwin/
$CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
$CPPFLAGS += " -g" unless $CPPFLAGS.split.include? "-g"
$CPPFLAGS += " -rdynamic" unless $CPPFLAGS.split.include? "-rdynamic"
$CPPFLAGS += " -fPIC" unless $CPPFLAGS.split.include? "-rdynamic" or RUBY_PLATFORM =~ /darwin/

# The order that the libs are listed matters for Linux!
# to debug missing symbols you can run:
#    for l in `ls /usr/lib/pdfium/*.a`; do echo $l; nm $l | grep 'CRYPT_SHA256Start'; done
# The listing with a "T" contains the symbol, the ones with a "U"
# depend on it.  The "U" libs must come after the "T"
LIBS=%w{javascript bigint freetype fpdfdoc fpdftext formfiller
icudata icuuc icui18n v8_libbase v8_base v8_snapshot v8_libplatform  jsapi
pdfwindow fxedit fxcodec fxcrt fpdfdoc  fdrm fpdfapi
fxge freetype pdfium pthread }

dir_config("libs", HEADER_DIRS, LIB_DIRS)

LIBS.each do | lib |
  have_library(lib) or abort "Didn't find library lib#{lib}"
end

if `uname`.chomp == 'Darwin' then

  FRAMEWORKS = %w{AppKit CoreFoundation}

  $LDFLAGS << FRAMEWORKS.map { |f| " -framework #{f}" }.join
end

create_makefile "pdfium_ext"
{'fraction_non_alphanumeric': 0.12547348484848486, 'fraction_numerical': 0.007102272727272727, 'mean_word_length': 4.7574931880108995, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1864755', 'n_tokens_mistral': 836, 'n_tokens_neox': 808, 'n_words': 214}