Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Dec 25, 2024
1 parent 20fba17 commit 7851c45
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 58 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,61 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master
push

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Set up CMake
- name: Set up dependencies for Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -qq cmake build-essential
sudo apt-get install -qq cmake build-essential clang
- name: Set up Homebrew
- name: Set up dependencies for macOS
if: runner.os == 'macOS'
run: |
brew update
brew upgrade cmake
- name: Set up compiler
run: |
sudo apt-get install -qq clang
brew upgrade cmake
brew install automake autoconf fontconfig
- name: Display versions
run: |
gcc -v
g++ -v
cmake --version
- name: set env variables
if: runner.os == 'macOS'
run: |
echo "" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
- name: Build
if: runner.os == 'macOS'
env:
C_INCLUDE_PATH: '/opt/homebrew/include'
CPLUS_INCLUDE_PATH: '/opt/homebrew/include'
run: |
sh install_deps.sh
cmake ./
make
- name: Build
if: runner.os == 'Linux'
run: |
sh install_deps.sh
cmake ./
make
98 changes: 55 additions & 43 deletions install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,56 @@ FREETYPE_URI=https://download.savannah.gnu.org/releases/freetype/freetype-2.9.ta
#ICU_URI=http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
ICU_URI="https://github.com/unicode-org/icu/releases/download/release-62-2/icu4c-62_2-src.tgz"
#ICU_URI=https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz
# Latest version
# ICU_URI="https://github.com/unicode-org/icu/archive/refs/tags/release-76-1.tar.gz"

ICU_FILENAME=$(basename "${ICU_URI}")
ICU_DIR_NAME=icu

mkdir -p $DEP_INSTALL_DIR
mkdir -p "${DEP_INSTALL_DIR}"

cd $DEP_INSTALL_DIR
cd "${DEP_INSTALL_DIR}"

if [[ "$OSTYPE" == "linux-gnu" ]]; then
if ! [ -x "$(command -v autoreconf)" ]; then
sudo apt-get install autoconf
fi
ICU_CONFIG="Linux"
LIB_INSTALL="linux"
echo ${OSTYPE}

if [[ "${OSTYPE}" == "linux"* ]]; then
if ! [ -x "$(command -v autoreconf)" ]; then
sudo apt-get install autoconf
fi
ICU_CONFIG="Linux"
LIB_INSTALL="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
if ! [ -x "$(command -v autoreconf)" ]; then
brew install autoreconf
fi
ICU_CONFIG="MacOSX"
LIB_INSTALL="mac"
# Mac OSX
if ! [ -x "$(command -v autoreconf)" ]; then
brew install autoconf automake
fi
ICU_CONFIG="MacOSX"
LIB_INSTALL="mac"
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
ICU_CONFIG="Cygwin"
LIB_INSTALL="windows"
#elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
#elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
#elif [[ "$OSTYPE" == "freebsd"* ]]; then
# ...
#else
# Unknown.
# POSIX compatibility layer and Linux environment emulation for Windows
ICU_CONFIG="Cygwin"
LIB_INSTALL="windows"
#elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
#elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
#elif [[ "$OSTYPE" == "freebsd"* ]]; then
# ...
else
echo "Unknown OSTYPE: $OSTYPE, assuming it's LINUX"
if ! [ -x "$(command -v autoreconf)" ]; then
sudo apt-get install autoconf
fi
ICU_CONFIG="Linux"
LIB_INSTALL="linux"
fi

echo "$LIB_INSTALL"
echo "${LIB_INSTALL}"

echo 'Installing libxml2.'
#
rm -rf libxml2-2.9.8
wget -nc $LIBXML_URI
wget -nc "${LIBXML_URI}"

tar xvf libxml2-2.9.8.tar.gz

Expand Down Expand Up @@ -106,15 +115,16 @@ echo 'Installing ICU.'

rm -rf "${ICU_DIR_NAME}"

wget -nc $ICU_URI
wget -nc ${ICU_URI}

tar xvf "${ICU_FILENAME}"

cd "${ICU_DIR_NAME}/source" && mkdir lib && mkdir bin

chmod +x runConfigureICU configure install-sh

./runConfigureICU $ICU_CONFIG --enable-static --disable-shared
echo "ICU_CONFIG -> ${ICU_CONFIG}"
./runConfigureICU "${ICU_CONFIG}" --enable-static --disable-shared

make

Expand All @@ -126,30 +136,32 @@ echo 'Installing zlib and png.'

cd ..

cd libs/image/zlib/src && cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make && cd -
cd libs/image/png/src && cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make && cd -
cd libs/image/zlib/src && cmake -S . -B build "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make -C build && cd -
cd libs/image/png/src && cmake -S . -B build "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" && make -C build && cd -

echo 'zlib and png installation is finished.'

echo 'Copying libraries into their corresponding location.'
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
MACHINE_TYPE=$(uname -m)
if [[ "${MACHINE_TYPE}" == 'x86_64' ]]; then
ARCH="64"
elif [ ${MACHINE_TYPE} == 'arm64' ]; then
elif [[ "${MACHINE_TYPE}" == 'arm64' ]]; then
ARCH="arm64"
else
ARCH="32"
fi
cp libs/image/zlib/src/libzlib.a libs/image/zlib/$LIB_INSTALL/$ARCH/
cp libs/image/png/src/libpng.a libs/image/png/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/freetype-2.9/_build/libfreetype.a libs/freetype/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/libxml2-2.9.8/.libs/libxml2.a libs/libxml/$LIB_INSTALL/$ARCH/

cp "libs/image/zlib/src/build/libzlib.a" "libs/image/zlib/${LIB_INSTALL}/$ARCH/"
cp "libs/image/png/src/build/libpng.a" "libs/image/png/${LIB_INSTALL}/$ARCH/"
cp "${DEP_INSTALL_DIR}/freetype-2.9/_build/libfreetype.a" "libs/freetype/${LIB_INSTALL}/${ARCH}/"
cp "${DEP_INSTALL_DIR}/libxml2-2.9.8/.libs/libxml2.a" "libs/libxml/${LIB_INSTALL}/${ARCH}/"
if [[ "$OSTYPE" == "cygwin" ]]; then
mv $DEP_INSTALL_DIR/icu/source/lib/libsicuuc.a $DEP_INSTALL_DIR/icu/source/lib/libicuuc.a
mv $DEP_INSTALL_DIR/icu/source/lib/libsicudata.a $DEP_INSTALL_DIR/icu/source/lib/libicudata.a
mv "${DEP_INSTALL_DIR}/icu/source/lib/libsicuuc.a" "${DEP_INSTALL_DIR}/icu/source/lib/libicuuc.a"
mv "${DEP_INSTALL_DIR}/icu/source/lib/libsicudata.a" "${DEP_INSTALL_DIR}/icu/source/lib/libicudata.a"
fi
cp $DEP_INSTALL_DIR/icu/source/lib/libicuuc.a libs/icu/$LIB_INSTALL/$ARCH/
cp $DEP_INSTALL_DIR/icu/source/lib/libicudata.a libs/icu/$LIB_INSTALL/$ARCH/

cp "${DEP_INSTALL_DIR}/icu/source/lib/libicuuc.a" "libs/icu/${LIB_INSTALL}/${ARCH}/"
cp "${DEP_INSTALL_DIR}/icu/source/lib/libicudata.a" "libs/icu/${LIB_INSTALL}/${ARCH}/"

rm -rf $DEP_INSTALL_DIR

Expand All @@ -172,7 +184,7 @@ languages=(
for language in "${languages[@]}" ; do
#language_dir="${language}"
language_url="https://dl.xpdfreader.com/xpdf-${language}.tar.gz"
wget -qO- "${language_url}" | tar xvfz -
wget -qO- "${language_url}" | tar xvfz -
done
cp xpdfrc ..

Expand Down
Binary file added libs/freetype/mac/arm64/libfreetype.a
Binary file not shown.
Binary file added libs/icu/mac/arm64/libicudata.a
Binary file not shown.
Binary file added libs/icu/mac/arm64/libicuuc.a
Binary file not shown.
Binary file added libs/image/png/mac/arm64/libpng.a
Binary file not shown.
Binary file added libs/libxml/mac/arm64/libxml2.a
Binary file not shown.

0 comments on commit 7851c45

Please sign in to comment.