Skip to content

Commit

Permalink
Merge branch 'main' into hotfix/change-cmake-version
Browse files Browse the repository at this point in the history
  • Loading branch information
xingularity committed Feb 2, 2024
2 parents d10aca2 + 861b087 commit 20faefd
Show file tree
Hide file tree
Showing 21 changed files with 784 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/shunit2_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15]
os: [ubuntu-20.04, macos-12]
fail-fast: false
steps:
- name: Checkout repository
Expand Down
57 changes: 57 additions & 0 deletions applications/modmesh/twnia1_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#PBS -P <PROJECTSYSTEMCODE>
#PBS -N build_modmesh_env
#PBS -l select=1:ncpus=8:mpiprocs=8
#PBS -q <NODETYPE>
#PBS -j oe

# * this script is used to build the modmesh environment
# it should work directly in login node, or you can submit it to the queue system
# by using qsub command, for example:
# qsub -v DEVENVFLAVOR=mmenv twnia1_env.sh
# * you have to decide <PROJECTSYSTEMCODE>. check by command: get_su_balance
# * you have to decide <NODETYPE> to other node type, e.g. cf160, ct160, etc.

# * install devenv before running this script
if [ -f ~/devenv/scripts/init ]; then source ~/devenv/scripts/init; fi

module load gcc/11.2.0
export CC=/pkg/gcc/11.2.0/bin/gcc
export CXX=/pkg/gcc/11.2.0/bin/g++
# * download LLVM before running this script, for twnia1:
# https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_120-based-linux-Rhel7.6-gcc5.3-x86_64.7z
export LLVM_INSTALL_DIR=~/libclang120

DEVENVFLAVOR=${DEVENVFLAVOR:-"mmenv"}
echo "deleting old flavor: ${DEVENVFLAVOR}"
devenv del ${DEVENVFLAVOR}
devenv use ${DEVENVFLAVOR}

export PKG_CONFIG_PATH="$(pkg-config --variable pc_path pkg-config)"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DEVENVPREFIX}/lib64/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DEVENVPREFIX}/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DEVENVPREFIX}/share/pkgconfig

devenv build libffi

devenv build xcb

devenv build openssl

CPPFLAGS=-I${DEVENVPREFIX}/lib/libffi-*/include devenv build python

devenv build cmake

pip3 cache purge

pip3 install ninja meson

devenv build libxkbcommon

devenv build qt

pip3 install numpy pytest flake8 matplotlib pybind11

# required by pyside6
pip3 install patchelf==0.15
PYSIDE_BUILD=1 MAKESPEC=ninja VERSION=$(qmake -query QT_VERSION) devenv build pyside6
29 changes: 29 additions & 0 deletions scripts/build.d/automake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

pkgname=automake
pkgver=${VERSION:-1.16.5}
pkgfull=$pkgname-$pkgver
pkgfn=$pkgfull.tar.gz
pkgurl=http://ftp.twaren.net/Unix/GNU/gnu/${pkgname}/${pkgfn}

download_md5 $pkgfn $pkgurl 00502a65dee9f9e1a9f47aa55b7de4f7

mkdir -p ${DEVENVCURRENTROOT}/src
pushd ${DEVENVCURRENTROOT}/src > /dev/null
tar xf ${DEVENVDLROOT}/$pkgfn
popd > /dev/null

cfgcmd=("./configure")
cfgcmd+=("--prefix=${DEVENVPREFIX}")

pushd ${DEVENVCURRENTROOT}/src/${pkgfull} > /dev/null

buildcmd configure.log "${cfgcmd[@]}"
buildcmd make.log make -j ${NP}
buildcmd install.log make install

popd > /dev/null

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
30 changes: 30 additions & 0 deletions scripts/build.d/libffi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e

pkgname=libffi
pkgver=${VERSION:-3.0.13}
pkgfull=$pkgname-$pkgver
pkgfn=$pkgfull.tar.gz
pkgmd5=45f3b6dbc9ee7c7dfbbbc5feba571529
pkgurl=https://src.fedoraproject.org/repo/pkgs/libffi/${pkgfn}/${pkgmd5}/${pkgfn}

download_md5 $pkgfn $pkgurl $pkgmd5

mkdir -p ${DEVENVCURRENTROOT}/src
pushd ${DEVENVCURRENTROOT}/src > /dev/null
tar xf ${DEVENVDLROOT}/$pkgfn
popd > /dev/null

cfgcmd=("./configure")
cfgcmd+=("--prefix=${DEVENVPREFIX}")

pushd ${DEVENVCURRENTROOT}/src/${pkgfull} > /dev/null

buildcmd configure.log "${cfgcmd[@]}"
buildcmd make.log make -j ${NP}
buildcmd install.log make install

popd > /dev/null

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
33 changes: 33 additions & 0 deletions scripts/build.d/libxkbcommon
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -e

pkgname=libxkbcommon
pkgver=${VERSION:-1.5.0}
pkgfull=$pkgname-$pkgver
pkgfn=$pkgfull.tar.xz
pkgurl=https://xkbcommon.org/download/${pkgfn}

download_md5 $pkgfn $pkgurl 40f0486b4eb491928ec6616c2ff85120

mkdir -p ${DEVENVCURRENTROOT}/src
pushd ${DEVENVCURRENTROOT}/src > /dev/null
tar xf ${DEVENVDLROOT}/$pkgfn
popd > /dev/null

cfgcmd=("meson")
cfgcmd+=("setup")
cfgcmd+=("build")
cfgcmd+=("--prefix=${DEVENVPREFIX}")
cfgcmd+=("-Denable-wayland=false")

pushd ${DEVENVCURRENTROOT}/src/${pkgfull} > /dev/null

buildcmd configure.log "${cfgcmd[@]}"
buildcmd make.log ninja -C build
buildcmd test.log ninja -C build test
buildcmd install.log ninja -C build install

popd > /dev/null

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
29 changes: 29 additions & 0 deletions scripts/build.d/pkgconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

pkgname=pkg-config
pkgver=${VERSION:-0.29.2}
pkgfull=$pkgname-$pkgver
pkgfn=$pkgfull.tar.gz
pkgurl=https://pkgconfig.freedesktop.org/releases/${pkgfn}

download_md5 $pkgfn $pkgurl f6e931e319531b736fadc017f470e68a

mkdir -p ${DEVENVCURRENTROOT}/src
pushd ${DEVENVCURRENTROOT}/src > /dev/null
tar xf ${DEVENVDLROOT}/$pkgfn
popd > /dev/null

cfgcmd=("./configure")
cfgcmd+=("--prefix=${DEVENVPREFIX}")

pushd ${DEVENVCURRENTROOT}/src/${pkgfull} > /dev/null

buildcmd configure.log "${cfgcmd[@]}"
buildcmd make.log make -j ${NP}
buildcmd install.log make install

popd > /dev/null

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
4 changes: 2 additions & 2 deletions scripts/build.d/pybind11
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [ "${SRCSYNC}" == "tarball" ] ; then
pkgver=${VERSION:-2.10.2}
pkgfull=${pkgname}-${pkgver}
pkgfn=${pkgfull}.tar.gz
pkgurl=https://github.com/pybind/pybind11/archive/refs/tags/v${pkgfull}
pkgurl=https://github.com/pybind/pybind11/archive/refs/tags/v${pkgver}.tar.gz

download_md5 $pkgfn $pkgurl 695df9e99d92cdaa7fd0449fc5f30c26

Expand All @@ -23,7 +23,7 @@ elif [ "${SRCSYNC}" == "git" ] ; then

pkgname=pybind11
pkgbranch=${VERSION:-master}
pkgfull=$pkgname
pkgfull=${pkgname}-${pkgbranch}

# unpack (clone)
syncgit https://github.com/pybind ${pkgname} ${pkgbranch} ${pkgfull}
Expand Down
23 changes: 19 additions & 4 deletions scripts/build.d/pyside6
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ fi

PYTHON=${DEVENVPREFIX}/bin/python3

LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR:-$(command -v llvm-config --prefix)}
if [ -z "${LLVM_INSTALL_DIR}" ] ; then
# set LLVM_INSTALL_DIR to select the libclang installation for shiboken.
# For example, a brew installed libclang may be specified with:
# export LLVM_INSTALL_DIR=/opt/homebrew/opt/llvm
echo "\${LLVM_INSTALL_DIR} is not set, shiboken might not find libclang"
fi

QTPATHS=$(which qtpaths)
if [ -z "${QTPATHS}" ] ; then
# A locally installed qt might be specified with:
# export QTPATHS=${HOME}/opt/qt/6.2.3/macos/bin/qtpaths
Expand Down Expand Up @@ -99,11 +101,24 @@ EOF
exit
fi

buildcmd install.log ${PYTHON} setup.py install \
--qtpaths=${QTPATHS} \
--ignore-git \
--reuse-build
install_cmd=("${PYTHON}")
install_cmd+=("setup.py")
install_cmd+=("install")

# Ninja build will casue OOM during install
# stage on Archlinux, therefore using GNU Make
# instead of Ninja build to prevent OOM.
if [ $(uname) == Linux ]; then
MAKESPEC=${MAKESPEC:-make}
install_cmd+=("--make-spec=${MAKESPEC}")
install_cmd+=("--parallel=${NP}")
fi

install_cmd+=("--qtpaths=${QTPATHS}")
install_cmd+=("--ignore-git")
install_cmd+=("--reuse-build")

buildcmd install.log "${install_cmd[@]}"
popd > /dev/null

# vim: set et nobomb ft=bash ff=unix fenc=utf8:
22 changes: 14 additions & 8 deletions scripts/build.d/python
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ get_pip() {
if [ "${SRCSYNC}" == "tarball" ] ; then

pkgname=Python
pkgver=${VERSION:-3.11.1}
pkgver=${VERSION:-3.11.6}
pkgfull=${pkgname}-${pkgver}
pkgfn=${pkgfull}.tar.xz
pkgurl=https://www.python.org/ftp/python/${pkgver}/${pkgfn}

download_md5 $pkgfn $pkgurl 4efe92adf28875c77d3b9b2e8d3bc44a
download_md5 $pkgfn $pkgurl d0c5a1a31efe879723e51addf56dd206

mkdir -p ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src > /dev/null
Expand Down Expand Up @@ -57,22 +57,25 @@ pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
sed -i -e "s/@OSX_ARCH@/${ARCH}/g" Lib/distutils/unixccompiler.py
elif [ $(uname) == Linux ]; then
export CPPFLAGS="-I${PREFIX}/include ${CPPFLAGS}"
export LDFLAGS="-L${PREFIX}/lib -Wl,-rpath=${PREFIX}/lib,--no-as-needed"
export LDFLAGS="-Wl,--no-as-needed -Wl,-rpath,${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib64 -L${PREFIX}/lib -L${PREFIX}/lib64"
fi

cfgcmd=("./configure")
cfgcmd+=("--prefix=${PREFIX}")
cfgcmd+=("--enable-shared")
cfgcmd+=("--enable-ipv6")
cfgcmd+=("--with-ensurepip=no")
cfgcmd+=("--enable-optimizations")
cfgcmd+=("--without-ensurepip")
cfgcmd+=("--with-system-expat")
cfgcmd+=("--with-system-ffi")
cfgcmd+=("--with-system-libmpdec")
cfgcmd+=("--with-readline=editline")
cfgcmd+=("--with-lto")
cfgcmd+=("--with-tcltk-includes=-I${PREFIX}/include")
cfgcmd+=("--with-tcltk-libs=\"-L${PREFIX}/lib -ltcl8.5 -ltk8.5\"")
cfgcmd+=("--with-openssl=${DEVENVPREFIX}")

if [[ $(uname) == Darwin ]] ; then
cfgcmd+=("LLVM_AR=/usr/bin/ar")
cfgcmd+=("--with-dtrace")
cfgcmd+=("--with-dbmliborder=ndbm")
fi

# Some Python extension does not work properly without this, e.g., pandas.
Expand All @@ -84,7 +87,10 @@ pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

# build.
buildcmd configure.log "${cfgcmd[@]}"
buildcmd test.log make test -j ${NP}
[ ! -z "$BUILDTEST" ] && buildcmd test.log make test -j ${NP}
# If using configure --enable-optimizations, "make profile-opt" may be
# replaced with "make install" and two consecutive "make install" are needed.
buildcmd profile-opt.log make profile-opt -j ${NP}
buildcmd install.log make install -j ${NP}

# check python version
Expand Down
Loading

0 comments on commit 20faefd

Please sign in to comment.