cld2 - Detects over 80 languages in Unicode UTF-8 text ChangeLog

HOWTO


# Compact Language Detector 2
# ===========================
# There is a cld3, but I need cld2 for Cyrus IMAP
# GitHub google/cld3

# Prerequisites:
# git
# GCC
# coreutils
# ...

# Wow, no autoconf or CMake, it's been a while...

# Create a src directory under your home directory
mkdir -p -m 0700 ~/src
cd ~/src

# If it's there already, clean it up and update it
test -d ./cld2 &&
( cd cld2/internal
   ./clean.sh
   cd ..
   git fetch )

# If it's not there already, get it via 'git clone'
git clone https://github.com/CLD2Owners/cld2.git

cd cld2/internal

# If you have compiled it before, clean up
./clean.sh

# Build it
# If this CPPFLAGS doesn't work for you, check Github Issues and/or
# slackbuilds.org and/or Ubuntu packages
# https://packages.ubuntu.com/search?keywords=cld2&searchon=names&suite=all§ion=all
# Fedora
# https://rpmfind.net/linux/rpm2html/search.php?query=cld2&submit=Search+...
# openSUSE, etc., etc. for other ideas...
CPPFLAGS="-std=c++98 -O2" ./compile_libs.sh

cd ..

# Create a cld2.pc for pkg-config
# Change lib64 to lib if you are not 64-bit
# Version used here is the YYYYMMDD of the latest commit
echo "prefix=/usr" > cld2.pc
echo "exec_prefix=\${prefix}" >> cld2.pc
echo "libdir=\${exec_prefix}/lib64" >> cld2.pc
echo "includedir=\${prefix}/include" >> cld2.pc
echo >> cld2.pc
echo "Name: cld2" >> cld2.pc
echo "Description: Compact Language Detector 2" >> cld2.pc
echo "Version: 20150820" >> cld2.pc
echo "Libs: -L\${libdir} -lcld2" >> cld2.pc
echo "Cflags: -I\${includedir}" >> cld2.pc

# Become root to install it
su

# Install it
test $(uname -m) = 'x86_64' &&
( install -m 755 internal/libcld2.so /usr/lib64/
   install -m 755 internal/libcld2_full.so /usr/lib64/ )
test $(uname -m) != 'x86_64' &&
( install -m 755 internal/libcld2.so /usr/lib/
   install -m 755 internal/libcld2_full.so /usr/lib/ )
ldconfig
install -d -m 755 /usr/doc/cld2
install -d -m 755 /usr/include/cld2/internal
install -d -m 755 /usr/include/cld2/public
install -m 644 docs/* /usr/doc/cld2/
#install -m 644 internal/*.h /usr/include/cld2/internal/
( cd internal
  install -m 644 generated_language.h generated_ulscript.h \
   integral_types.h lang_script.h /usr/include/cld2/internal/ )
( cd public
  install -m 644 ./*.h /usr/include/cld2/public/ )
test -s ./cld2.pc -a -d /usr/lib64/pkgconfig &&
install -m 644 cld2.pc /usr/lib64/pkgconfig/

# Become your non-root user again
exit

# In case you look in ~/installed/ for it after a while...
echo "cld2 from GitHub is in ~/src/cld2" > ~/installed/cld2.README

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EDT -0400)
HOWTO last updated: 2023-09-14 10:31am
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]