Skip to content

Commit

Permalink
Merge pull request #36 from chestercheng/feat/customized-flavors-dir
Browse files Browse the repository at this point in the history
add DEVENVFLAVORROOT to support customized flavor dir
  • Loading branch information
tai271828 authored Jun 5, 2021
2 parents fc82eeb + 19ee899 commit 5b4563d
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 32 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ By using the following command to setup all necessary environment variables:
source scripts/init
```

## Advanced Configuration

* Customized flavors directory path: You may define the `DEVENVFLAVORROOT`
environment variable to point to the flavors root path where you want.


## Usage

Expand Down
4 changes: 2 additions & 2 deletions scripts/build.d/bzip2
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -e

pkgname=bzip2

git clone git://sourceware.org/git/bzip2.git ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgname}
git clone git://sourceware.org/git/bzip2.git ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgname}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgname} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgname} > /dev/null

INSTALL_PREFIX=${DEVENVPREFIX}
buildcmd make.log make install PREFIX=${INSTALL_PREFIX} -j ${NP}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ syncgit https://github.com/Kitware ${pkgname} ${pkgbranch}
cfgcmd=("./configure")
cfgcmd+=("--prefix=${DEVENVPREFIX}")

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

buildcmd configure.log "${cfgcmd[@]}"
buildcmd make.log make -j ${NP}
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/cython
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgfull=${pkgname}-${pkgbranch}

syncgit https://github.com/cython ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

PYTHON=${DEVENVPREFIX}/bin/python3

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/gmsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgfull=$pkgname-$pkgbranch

syncgit https://gitlab.onelab.info/gmsh/ ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

mkdir -p build

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/hdf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgfull=${pkgname}-${pkgbranch}
# unpack (clone / pull)
syncgit https://github.com/HDFGroup ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

mkdir -p build
cd build
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.d/modmesh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ PYTHON=${DEVENVPREFIX}/bin/python3

syncgit https://github.com/solvcon ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

if [ -e build ]; then
rm -rf build
fi

mkdir -p build

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull}/build > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull}/build > /dev/null

cmakecmd=("cmake")
cmakecmd+=("-DCMAKE_INSTALL_PREFIX=${DEVENVPREFIX}")
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/netcdf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgfull=${pkgname}-${pkgbranch}
# unpack (clone / pull)
syncgit https://github.com/Unidata ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

mkdir -p build
cd build
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/numpy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgfull=${pkgname}-${pkgbranch}
# unpack (clone / pull)
syncgit https://github.com/numpy ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

# prepare files for building.
if [ ! -e ${DEVENVPREFIX}/bin/python3 ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/openblas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgfull=${pkgname}-${pkgbranch}
# unpack (clone / pull)
syncgit https://github.com/xianyi ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

mkdir -p build
cd build
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/openssl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgfull=${pkgname}-${pkgbranch}

syncgit https://github.com/openssl ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

cfgcmd=("./config")
cfgcmd+=("--prefix=${DEVENVPREFIX}")
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.d/pybind11
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ elif [[ $DEVENVFLAVOR == dbg* ]] ; then
cmakecmd+=("-DCMAKE_BUILD_TYPE=Debug")
fi

mkdir -p ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull}/build
mkdir -p ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull}/build

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull}/build > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull}/build > /dev/null

buildcmd cmake.log "${cmakecmd[@]}" ..
buildcmd make.log make -j $NP
buildcmd install.log make install

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
buildcmd build/setup.log $PYTHON setup.py install
popd > /dev/null

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/python
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgfull=${pkgname}-${pkgbranch}

syncgit https://github.com/python ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

# build
PREFIX=${DEVENVPREFIX}
Expand Down
8 changes: 4 additions & 4 deletions scripts/build.d/scotch
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ -z "${SYNCGIT}" ]; then
# download tarball
download_md5 $pkgfn $pkgurl 5b851c3dc0a54185aecb44980ed3a334

mkdir -p ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src
cd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src
mkdir -p ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src
cd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src
tar xf ${DEVENVDLROOT}/$pkgfn
else
pkgname=scotch
Expand All @@ -24,8 +24,8 @@ else
syncgit https://gitlab.inria.fr/scotch ${pkgname} ${pkgbranch}
fi

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull}/src
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull}/src
# build.
rm -f Makefile.inc
echo "prefix = $DEVENVPREFIX" > Makefile.inc
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/xz
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgfull=$pkgname-$pkgbranch

syncgit https://github.com/xz-mirror/ ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

mkdir -p build

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.d/zlib
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgfull=${pkgname}-${pkgbranch}

syncgit https://github.com/madler ${pkgname} ${pkgbranch}

pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src/${pkgfull} > /dev/null

# build.
buildcmd configure.log ./configure --prefix=${DEVENVPREFIX}
Expand Down
4 changes: 2 additions & 2 deletions scripts/cmd.d/add
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
. ${DEVENVROOT}/scripts/func.d/bash_utils

if [ ! -d "${DEVENVROOT}/flavors/$1" ]; then
mkdir -p ${DEVENVROOT}/flavors/$1
if [ ! -d "${DEVENVFLAVORROOT}/$1" ]; then
mkdir -p ${DEVENVFLAVORROOT}/$1
display "create '${1}' dev environment."
elif [ -z $1 ]; then
display -e "must need an argument!!"
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmd.d/del
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ -z $1 ]; then
display -e "must need an argument!!"
else
rm -rf ${DEVENVROOT}/flavors/$1
rm -rf ${DEVENVFLAVORROOT}/$1
display "removing '$1' dev environment"
fi

Expand Down
6 changes: 3 additions & 3 deletions scripts/env.d/devenv_impl
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ case "$(uname)" in
;;
esac

eval "$1 PATH ${DEVENVROOT}/flavors/$2/usr/bin"
eval "$1 ${lib_path} ${DEVENVROOT}/flavors/$2/usr/lib"
eval "$1 PATH ${DEVENVFLAVORROOT}/$2/usr/bin"
eval "$1 ${lib_path} ${DEVENVFLAVORROOT}/$2/usr/lib"

if [[ "$1" == namemunge ]]; then
export DEVENVFLAVOR=$2
export DEVENVPREFIX=${DEVENVROOT}/flavors/${DEVENVFLAVOR}/usr
export DEVENVPREFIX=${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/usr
elif [[ "$1" == "nameremove" ]]; then
unset DEVENVFLAVOR
unset DEVENVPREFIX
Expand Down
1 change: 1 addition & 0 deletions scripts/env.d/vars
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export DEVENVFLAVOR=""
export DEVENVPREFIX=""
export DEVENVPATH_BACKUP="${PATH}"
export DEVENVDLROOT="${DEVENVROOT}/var/downloaded"
export DEVENVFLAVORROOT="${DEVENVFLAVORROOT:-$DEVENVROOT/flavors}"
case "$(uname)" in
Darwin)
export DEVENVLIBRARY_PATH_BACKUP="${DYLD_FALLBACK_LIBRARY_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/func.d/bash_utils
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ get_list() {
local dir=""
case $1 in
flavor)
dir="${DEVENVROOT}/flavors"
dir="${DEVENVFLAVORROOT}"
;;
build)
dir="${DEVENVROOT}/scripts/build.d"
Expand Down
4 changes: 2 additions & 2 deletions scripts/func.d/build_utils
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ syncgit () {
local pkgrepo=${giturl}/${pkgname}.git

# unpack (clone)
mkdir -p ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src
pushd ${DEVENVROOT}/flavors/${DEVENVFLAVOR}/src > /dev/null
mkdir -p ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src
pushd ${DEVENVFLAVORROOT}/${DEVENVFLAVOR}/src > /dev/null

if [ ! -d ${pkgfull} ] ; then
git clone -b ${pkgbranch} ${pkgrepo} ${pkgfull}
Expand Down
2 changes: 1 addition & 1 deletion scripts/init
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ devenv() {
if [[ "$1" == "use" ]]; then
shift

if [ ! -d "${DEVENVROOT}/flavors/$1" ]; then
if [ ! -d "${DEVENVFLAVORROOT}/$1" ]; then
display "not hacking"
return
fi
Expand Down

0 comments on commit 5b4563d

Please sign in to comment.