updating so artifacts to live in jni folder instead of jniLibs

# !/bin/bash
# Copyright Pristine Inc
# Author: Rahul Behera <rahul@pristine.io>
# Author: Aaron Alaniz <aaron@pristine.io>
# Author: Arik Yaacob   <arik@pristine.io>
#
# Builds the android peer connection library

# Get location of the script itself .. thanks SO ! http://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
    DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
    SOURCE="$(readlink "$SOURCE")"
    [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Utility method for creating a directory
create_directory_if_not_found() {
	# if we cannot find the directory
	if [ ! -d "$1" ];
		then
		echo "$1 directory not found, creating..."
	    mkdir -p "$1"
	    echo "directory created at $1"
	fi
}

DEFAULT_WEBRTC_URL="http://webrtc.googlecode.com/svn/trunk"
DEPOT_TOOLS="$PROJECT_ROOT/depot_tools"
WEBRTC_ROOT="$PROJECT_ROOT/webrtc"
create_directory_if_not_found $WEBRTC_ROOT
BUILD="$WEBRTC_ROOT/libjingle_peerconnection_builds"
WEBRTC_TARGET="AppRTCDemo"

ANDROID_TOOLCHAINS="$WEBRTC_ROOT/src/third_party/android_tools/ndk/toolchains"

exec_ninja() {
  echo "Running ninja"
  ninja -C $1 $WEBRTC_TARGET
}

# Installs the required dependencies on the machine
install_dependencies() {
    sudo apt-get -y install wget git gnupg flex bison gperf build-essential zip curl subversion pkg-config
    #Download the latest script to install the android dependencies for ubuntu
    curl -o install-build-deps-android.sh https://src.chromium.org/svn/trunk/src/build/install-build-deps-android.sh
    #use bash (not dash which is default) to run the script
    sudo /bin/bash ./install-build-deps-android.sh
    #delete the file we just downloaded... not needed anymore
    rm install-build-deps-android.sh
}

# Update/Get/Ensure the Gclient Depot Tools
# Also will add to your environment
pull_depot_tools() {
	WORKING_DIR=`pwd`

    # Either clone or get latest depot tools
	if [ ! -d "$DEPOT_TOOLS" ]
	then
	    echo Make directory for gclient called Depot Tools
	    mkdir -p $DEPOT_TOOLS

	    echo Pull the depo tools project from chromium source into the depot tools directory
	    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS

	else
		echo Change directory into the depot tools
		cd $DEPOT_TOOLS

		echo Pull the depot tools down to the latest
		git pull
	fi
	PATH="$PATH:$DEPOT_TOOLS"

    # Navigate back
	cd $WORKING_DIR
}

# Update/Get the webrtc code base
pull_webrtc() {
    WORKING_DIR=`pwd`

    # If no directory where webrtc root should be...
    create_directory_if_not_found $WEBRTC_ROOT
    cd $WEBRTC_ROOT

    # Setup gclient config
    echo Configuring gclient for Android build
    if [ -z $USER_WEBRTC_URL ]
    then
        echo "User has not specified a different webrtc url. Using default"
        gclient config --name=src "$DEFAULT_WEBRTC_URL"
    else
        echo "User has specified their own webrtc url $USER_WEBRTC_URL"
        gclient config --name=src "$USER_WEBRTC_URL"
    fi

    # Ensure our target os is correct building android
	echo "target_os = ['unix', 'android']" >> .gclient

    # Get latest webrtc source
	echo Pull down the latest from the webrtc repo
	echo this can take a while
	if [ -z $1 ]
    then
        echo "gclient sync with newest"
        gclient sync
    else
        echo "gclient sync with $1"
        gclient sync -r $1
    fi

    # Navigate back
	cd $WORKING_DIR
}

# Prepare our build
function wrbase() {
    export GYP_DEFINES="OS=android host_os=linux libjingle_java=1 build_with_libjingle=1 build_with_chromium=0 enable_tracing=1 enable_android_opensl=0"
    export GYP_GENERATORS="ninja"
}

# Arm V7 with Neon
function wrarmv7() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android"
    export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_android_armeabi-v7a"
    export GYP_CROSSCOMPILE=1
    echo "ARMv7 with Neon Build"
}

# Arm 64
function wrarmv8() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=arm64 target_subarch=arm64"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_arm64-v8a"
    export GYP_CROSSCOMPILE=1
    echo "ARMv8 with Neon Build"
}

# x86
function wrX86() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=ia32"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_x86"
    echo "x86 Build"
}

# x86_64
function wrX86_64() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=x64"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_x86_64"
    echo "x86_64 Build"
}

# Setup our defines for the build
prepare_gyp_defines() {
    # Configure environment for Android
    echo Setting up build environment for Android
    source $WEBRTC_ROOT/src/build/android/envsetup.sh

    # Check to see if the user wants to set their own gyp defines
    echo Export the base settings of GYP_DEFINES so we can define how we want to build
    if [ -z $USER_GYP_DEFINES ]
    then
        echo "User has not specified any gyp defines so we proceed with default"
        if [ "$WEBRTC_ARCH" = "x86" ] ;
        then
            wrX86
        elif [ "$WEBRTC_ARCH" = "x86_64" ] ;
        then
            wrX86_64
        elif [ "$WEBRTC_ARCH" = "armv7" ] ;
        then
            wrarmv7
        elif [ "$WEBRTC_ARCH" = "armv8" ] ;
        then
            wrarmv8
        fi
    else
        echo "User has specified their own gyp defines"
        export GYP_DEFINES="$USER_GYP_DEFINES"
    fi

    echo "GYP_DEFINES=$GYP_DEFINES"
}

# Builds the apprtc demo
execute_build() {
    WORKING_DIR=`pwd`
    cd "$WEBRTC_ROOT/src"

    echo Run gclient hooks
    gclient runhooks

    if [ "$WEBRTC_ARCH" = "x86" ] ;
    then
        ARCH="x86"
        STRIP=$ANDROID_TOOLCHAINS/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-strip
    elif [ "$WEBRTC_ARCH" = "x86_64" ] ;
    then
        ARCH="x86_64"
        STRIP=$ANDROID_TOOLCHAINS/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-strip
    elif [ "$WEBRTC_ARCH" = "armv7" ] ;
    then
        ARCH="armeabi-v7a"
        STRIP=$ANDROID_TOOLCHAINS/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip
    elif [ "$WEBRTC_ARCH" = "armv8" ] ;
    then
        ARCH="arm64-v8a"
        STRIP=$ANDROID_TOOLCHAINS/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip
    fi

    if [ "$WEBRTC_DEBUG" = "true" ] ;
    then
        BUILD_TYPE="Debug"
    else
        BUILD_TYPE="Release"
    fi

    ARCH_OUT="out_android_${ARCH}"
    REVISION_NUM=`get_webrtc_revision`
    echo "Build ${WEBRTC_TARGET} in $BUILD_TYPE (arch: ${WEBRTC_ARCH:-arm})"
    exec_ninja "$ARCH_OUT/$BUILD_TYPE"

    # Verify the build actually worked
    if [ $? -eq 0 ]; then
        SOURCE_DIR="$WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE"
        TARGET_DIR="$BUILD/$BUILD_TYPE"
        create_directory_if_not_found "$TARGET_DIR"

        echo "Copy JAR File"
        create_directory_if_not_found "$TARGET_DIR/libs/"
        create_directory_if_not_found "$TARGET_DIR/jni/"

        ARCH_JNI="$TARGET_DIR/jni/${ARCH}"
        create_directory_if_not_found $ARCH_JNI

        # Copy the jar
        cp -p "$SOURCE_DIR/libjingle_peerconnection.jar" "$TARGET_DIR/libs/"

        # Strip the build only if its release
        if [ "$WEBRTC_DEBUG" = "true" ] ;
        then
            cp -p $WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE/lib/libjingle_peerconnection_so.so $ARCH_JNI/libjingle_peerconnection_so.so
        else
            $STRIP -o $ARCH_JNI/libjingle_peerconnection_so.so $WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE/lib/libjingle_peerconnection_so.so -s
        fi

        cd $TARGET_DIR
        mkdir -p aidl
        mkdir -p assets
        mkdir -p res

        cd $WORKING_DIR
        echo "$BUILD_TYPE build for apprtc complete for revision $REVISION_NUM"
    else

        echo "$BUILD_TYPE build for apprtc failed for revision $REVISION_NUM"
        exit 1
    fi
}

# Gets the webrtc revision
get_webrtc_revision() {
    # Try for svn by default
    REVISION_NUMBER=`svn info "$WEBRTC_ROOT/src" | awk '{ if ($1 ~ /Revision/) { print $2 } }'`

    # If not set then user is probably using git
    if [ -z "$REVISION_NUMBER" ]
    then
        REVISION_NUMBER=`git describe --tags  | sed 's/\([0-9]*\)-.*/\1/'`
    fi

    echo $REVISION_NUMBER
}

get_webrtc() {
    pull_depot_tools &&
    pull_webrtc $1
}

# Updates webrtc and builds apprtc
build_apprtc() {
    export WEBRTC_ARCH=armv7
    prepare_gyp_defines &&
    execute_build

    # Uncomment once the application can successfully build for arm64
    #export WEBRTC_ARCH=armv8
    #prepare_gyp_defines &&
    #execute_build

    export WEBRTC_ARCH=x86
    prepare_gyp_defines &&
    execute_build

    export WEBRTC_ARCH=x86_64
    prepare_gyp_defines &&
    execute_build
}

# !/bin/bash
# Copyright Pristine Inc
# Author: Rahul Behera <rahul@pristine.io>
# Author: Aaron Alaniz <aaron@pristine.io>
# Author: Arik Yaacob   <arik@pristine.io>
#
# Builds the android peer connection library

# Get location of the script itself .. thanks SO ! http://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
    DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
    SOURCE="$(readlink "$SOURCE")"
    [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Utility method for creating a directory
create_directory_if_not_found() {
	# if we cannot find the directory
	if [ ! -d "$1" ];
		then
		echo "$1 directory not found, creating..."
	    mkdir -p "$1"
	    echo "directory created at $1"
	fi
}

DEFAULT_WEBRTC_URL="http://webrtc.googlecode.com/svn/trunk"
DEPOT_TOOLS="$PROJECT_ROOT/depot_tools"
WEBRTC_ROOT="$PROJECT_ROOT/webrtc"
create_directory_if_not_found $WEBRTC_ROOT
BUILD="$WEBRTC_ROOT/libjingle_peerconnection_builds"
WEBRTC_TARGET="AppRTCDemo"

ANDROID_TOOLCHAINS="$WEBRTC_ROOT/src/third_party/android_tools/ndk/toolchains"

exec_ninja() {
  echo "Running ninja"
  ninja -C $1 $WEBRTC_TARGET
}

# Installs the required dependencies on the machine
install_dependencies() {
    sudo apt-get -y install wget git gnupg flex bison gperf build-essential zip curl subversion pkg-config
    #Download the latest script to install the android dependencies for ubuntu
    curl -o install-build-deps-android.sh https://src.chromium.org/svn/trunk/src/build/install-build-deps-android.sh
    #use bash (not dash which is default) to run the script
    sudo /bin/bash ./install-build-deps-android.sh
    #delete the file we just downloaded... not needed anymore
    rm install-build-deps-android.sh
}

# Update/Get/Ensure the Gclient Depot Tools
# Also will add to your environment
pull_depot_tools() {
	WORKING_DIR=`pwd`

    # Either clone or get latest depot tools
	if [ ! -d "$DEPOT_TOOLS" ]
	then
	    echo Make directory for gclient called Depot Tools
	    mkdir -p $DEPOT_TOOLS

	    echo Pull the depo tools project from chromium source into the depot tools directory
	    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS

	else
		echo Change directory into the depot tools
		cd $DEPOT_TOOLS

		echo Pull the depot tools down to the latest
		git pull
	fi
	PATH="$PATH:$DEPOT_TOOLS"

    # Navigate back
	cd $WORKING_DIR
}

# Update/Get the webrtc code base
pull_webrtc() {
    WORKING_DIR=`pwd`

    # If no directory where webrtc root should be...
    create_directory_if_not_found $WEBRTC_ROOT
    cd $WEBRTC_ROOT

    # Setup gclient config
    echo Configuring gclient for Android build
    if [ -z $USER_WEBRTC_URL ]
    then
        echo "User has not specified a different webrtc url. Using default"
        gclient config --name=src "$DEFAULT_WEBRTC_URL"
    else
        echo "User has specified their own webrtc url $USER_WEBRTC_URL"
        gclient config --name=src "$USER_WEBRTC_URL"
    fi

    # Ensure our target os is correct building android
	echo "target_os = ['unix', 'android']" >> .gclient

    # Get latest webrtc source
	echo Pull down the latest from the webrtc repo
	echo this can take a while
	if [ -z $1 ]
    then
        echo "gclient sync with newest"
        gclient sync
    else
        echo "gclient sync with $1"
        gclient sync -r $1
    fi

    # Navigate back
	cd $WORKING_DIR
}

# Prepare our build
function wrbase() {
    export GYP_DEFINES="OS=android host_os=linux libjingle_java=1 build_with_libjingle=1 build_with_chromium=0 enable_tracing=1 enable_android_opensl=0"
    export GYP_GENERATORS="ninja"
}

# Arm V7 with Neon
function wrarmv7() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android"
    export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_android_armeabi-v7a"
    export GYP_CROSSCOMPILE=1
    echo "ARMv7 with Neon Build"
}

# Arm 64
function wrarmv8() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=arm64 target_subarch=arm64"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_arm64-v8a"
    export GYP_CROSSCOMPILE=1
    echo "ARMv8 with Neon Build"
}

# x86
function wrX86() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=ia32"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_x86"
    echo "x86 Build"
}

# x86_64
function wrX86_64() {
    wrbase
    export GYP_DEFINES="$GYP_DEFINES OS=android target_arch=x64"
    export GYP_GENERATOR_FLAGS="output_dir=out_android_x86_64"
    echo "x86_64 Build"
}

# Setup our defines for the build
prepare_gyp_defines() {
    # Configure environment for Android
    echo Setting up build environment for Android
    source $WEBRTC_ROOT/src/build/android/envsetup.sh

    # Check to see if the user wants to set their own gyp defines
    echo Export the base settings of GYP_DEFINES so we can define how we want to build
    if [ -z $USER_GYP_DEFINES ]
    then
        echo "User has not specified any gyp defines so we proceed with default"
        if [ "$WEBRTC_ARCH" = "x86" ] ;
        then
            wrX86
        elif [ "$WEBRTC_ARCH" = "x86_64" ] ;
        then
            wrX86_64
        elif [ "$WEBRTC_ARCH" = "armv7" ] ;
        then
            wrarmv7
        elif [ "$WEBRTC_ARCH" = "armv8" ] ;
        then
            wrarmv8
        fi
    else
        echo "User has specified their own gyp defines"
        export GYP_DEFINES="$USER_GYP_DEFINES"
    fi

    echo "GYP_DEFINES=$GYP_DEFINES"
}

# Builds the apprtc demo
execute_build() {
    WORKING_DIR=`pwd`
    cd "$WEBRTC_ROOT/src"

    echo Run gclient hooks
    gclient runhooks

    if [ "$WEBRTC_ARCH" = "x86" ] ;
    then
        ARCH="x86"
        STRIP=$ANDROID_TOOLCHAINS/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-strip
    elif [ "$WEBRTC_ARCH" = "x86_64" ] ;
    then
        ARCH="x86_64"
        STRIP=$ANDROID_TOOLCHAINS/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-strip
    elif [ "$WEBRTC_ARCH" = "armv7" ] ;
    then
        ARCH="armeabi-v7a"
        STRIP=$ANDROID_TOOLCHAINS/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip
    elif [ "$WEBRTC_ARCH" = "armv8" ] ;
    then
        ARCH="arm64-v8a"
        STRIP=$ANDROID_TOOLCHAINS/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip
    fi

    if [ "$WEBRTC_DEBUG" = "true" ] ;
    then
        BUILD_TYPE="Debug"
    else
        BUILD_TYPE="Release"
    fi

    ARCH_OUT="out_android_${ARCH}"
    REVISION_NUM=`get_webrtc_revision`
    echo "Build ${WEBRTC_TARGET} in $BUILD_TYPE (arch: ${WEBRTC_ARCH:-arm})"
    exec_ninja "$ARCH_OUT/$BUILD_TYPE"

    # Verify the build actually worked
    if [ $? -eq 0 ]; then
        SOURCE_DIR="$WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE"
        TARGET_DIR="$BUILD/$BUILD_TYPE"
        create_directory_if_not_found "$TARGET_DIR"

        echo "Copy JAR File"
        create_directory_if_not_found "$TARGET_DIR/libs/"
        create_directory_if_not_found "$TARGET_DIR/jniLibs/"

        ARCH_JNI="$TARGET_DIR/jniLibs/${ARCH}"
        create_directory_if_not_found $ARCH_JNI

        # Copy the jar
        cp -p "$SOURCE_DIR/libjingle_peerconnection.jar" "$TARGET_DIR/libs/"

        # Strip the build only if its release
        if [ "$WEBRTC_DEBUG" = "true" ] ;
        then
            cp -p $WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE/lib/libjingle_peerconnection_so.so $ARCH_JNI/libjingle_peerconnection_so.so
        else
            $STRIP -o $ARCH_JNI/libjingle_peerconnection_so.so $WEBRTC_ROOT/src/$ARCH_OUT/$BUILD_TYPE/lib/libjingle_peerconnection_so.so -s
        fi

        cd $TARGET_DIR
        mkdir -p aidl
        mkdir -p assets
        mkdir -p res

        cd $WORKING_DIR
        echo "$BUILD_TYPE build for apprtc complete for revision $REVISION_NUM"
    else

        echo "$BUILD_TYPE build for apprtc failed for revision $REVISION_NUM"
        exit 1
    fi
}

# Gets the webrtc revision
get_webrtc_revision() {
    # Try for svn by default
    REVISION_NUMBER=`svn info "$WEBRTC_ROOT/src" | awk '{ if ($1 ~ /Revision/) { print $2 } }'`

    # If not set then user is probably using git
    if [ -z "$REVISION_NUMBER" ]
    then
        REVISION_NUMBER=`git describe --tags  | sed 's/\([0-9]*\)-.*/\1/'`
    fi

    echo $REVISION_NUMBER
}

get_webrtc() {
    pull_depot_tools &&
    pull_webrtc $1
}

# Updates webrtc and builds apprtc
build_apprtc() {
    export WEBRTC_ARCH=armv7
    prepare_gyp_defines &&
    execute_build

    # Uncomment once the application can successfully build for arm64
    #export WEBRTC_ARCH=armv8
    #prepare_gyp_defines &&
    #execute_build

    export WEBRTC_ARCH=x86
    prepare_gyp_defines &&
    execute_build

    export WEBRTC_ARCH=x86_64
    prepare_gyp_defines &&
    execute_build
}


try files

try files

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bashrc/freedombone.git/'


make.bash: clear CDPATH to avoid output from cd

Fixes issue 306.

R=r, r1
http://codereview.appspot.com/160060

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/wesolows/golang-old.git/'


bracket highlighter: simplify

bracket highlighter: simplify

#!/usr/bin/env zsh
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
#  * Redistributions of source code must retain the above copyright notice, this list of conditions
#    and the following disclaimer.
#  * Redistributions in binary form must reproduce the above copyright notice, this list of
#    conditions and the following disclaimer in the documentation and/or other materials provided
#    with the distribution.
#  * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
#    may be used to endorse or promote products derived from this software without specific prior
#    written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------

# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold}
: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout}

# Whether the brackets highlighter should be called or not.
_zsh_highlight_brackets_highlighter_predicate()
{
  _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
}

# Brackets highlighting function.
_zsh_highlight_brackets_highlighter()
{
  local level=0 pos
  local -A levelpos lastoflevel matching typepos

  # Find all brackets and remember which one is matching
  for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do
    local char=$BUFFER[pos+1]
    case $char in
      ["([{"])
        levelpos[$pos]=$((++level))
        lastoflevel[$level]=$pos
        _zsh_highlight_brackets_highlighter_brackettype $char
        ;;
      [")]}"])
        matching[$lastoflevel[$level]]=$pos
        matching[$pos]=$lastoflevel[$level]
        levelpos[$pos]=$((level--))
        _zsh_highlight_brackets_highlighter_brackettype $char
        ;;
      ['"'\'])
        # Skip everything inside quotes
        local quotetype=$char
        while (( $pos < ${#BUFFER} )) ; do
          (( pos++ ))
          [[ $BUFFER[$pos+1] == $quotetype ]] && break
        done
        ;;
    esac
  done

  # Now highlight all found brackets
  for pos in ${(k)levelpos}; do
    if [[ -n $matching[$pos] ]] && [[ $typepos[$pos] == $typepos[$matching[$pos]] ]]; then
      local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]}
      local bracket_color_level=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
      local style=$ZSH_HIGHLIGHT_STYLES[$bracket_color_level]
      region_highlight+=("$pos $((pos + 1)) $style")
    else
      local style=$ZSH_HIGHLIGHT_STYLES[bracket-error]
      region_highlight+=("$pos $((pos + 1)) $style")
    fi
  done

  # If cursor is on a bracket, then highlight corresponding bracket, if any
  pos=$CURSOR
  if [[ -n $levelpos[$pos] ]] && [[ -n $matching[$pos] ]]; then
    local otherpos=$matching[$pos]
    local style=$ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]
    region_highlight+=("$otherpos $((otherpos + 1)) $style")
  fi
}

# Helper function to differentiate type
_zsh_highlight_brackets_highlighter_brackettype()
{
  case $1 in
    ["()"]) typepos[$pos]=round;;
    ["[]"]) typepos[$pos]=bracket;;
    ["{}"]) typepos[$pos]=curly;;
    *) ;;
  esac
}

#!/usr/bin/env zsh
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
#  * Redistributions of source code must retain the above copyright notice, this list of conditions
#    and the following disclaimer.
#  * Redistributions in binary form must reproduce the above copyright notice, this list of
#    conditions and the following disclaimer in the documentation and/or other materials provided
#    with the distribution.
#  * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
#    may be used to endorse or promote products derived from this software without specific prior
#    written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------

# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold}
: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout}

# Whether the brackets highlighter should be called or not.
_zsh_highlight_brackets_highlighter_predicate()
{
  _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
}

# Brackets highlighting function.
_zsh_highlight_brackets_highlighter()
{
  local level=0 pos
  local -A levelpos lastoflevel matching typepos

  # Find all brackets and remember which one is matching
  for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do
    local char=$BUFFER[pos+1]
    case $char in
      ["([{"])
        levelpos[$pos]=$((++level))
        lastoflevel[$level]=$pos
        typepos[$pos]=`_zsh_highlight_brackets_highlighter_brackettype $char`
        ;;
      [")]}"])
        matching[$lastoflevel[$level]]=$pos
        matching[$pos]=$lastoflevel[$level]
        levelpos[$pos]=$((level--))
        typepos[$pos]=`_zsh_highlight_brackets_highlighter_brackettype $char`
        ;;
      ['"'\'])
        # Skip everything inside quotes
        local quotetype=$char
        while (( $pos < ${#BUFFER} )) ; do
          (( pos++ ))
          [[ $BUFFER[$pos+1] == $quotetype ]] && break
        done
        ;;
    esac
  done

  # Now highlight all found brackets
  for pos in ${(k)levelpos}; do
    if [[ -z $matching[$pos] ]] || [[ $typepos[$pos] != $typepos[$matching[$pos]] ]]; then
      local style=$ZSH_HIGHLIGHT_STYLES[bracket-error]
      region_highlight+=("$pos $((pos + 1)) $style")
    else
      local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]}
      local bracket_color_level=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
      local style=$ZSH_HIGHLIGHT_STYLES[$bracket_color_level]
      region_highlight+=("$pos $((pos + 1)) $style")
    fi
  done

  # If cursor is on a bracket, then highlight corresponding bracket, if any
  pos=$CURSOR
  if [[ -n $levelpos[$pos] ]] && [[ -n $matching[$pos] ]]; then
    local otherpos=$matching[$pos]
    local style=$ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]
    region_highlight+=("$otherpos $((otherpos + 1)) $style")
  fi
}

# Helper function to differentiate type
_zsh_highlight_brackets_highlighter_brackettype()
{
  case $1 in
    ["()"]) print round;;
    ["[]"]) print bracket;;
    ["{}"]) print curly;;
    *) ;;
  esac
}


Angular Build CI

Angular Build CI

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pichardoJ/TheUnacademicPortfolio.git/'


Get rid of test-locally.sh, since this will happen explicitly inside the container in the dev loop.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/opensyllabus/osp-pipeline.git/'


Work on stand-alone install script for dependencies on ubuntu LTS.

#!/bin/bash

# WARNING:  If you upgrade versions of python3 (i.e. 3.6 --> 3.7) you will
# need to rerun this install.

# NOTE:  This script expects to be located in the toast/external/static
# directory, so that it can find patch files at the relative location.  You
# can run the script in some other working directory, but leave this file
# in place.  For example:
#
# $>  cd workdir
# $>  /path/to/toast/external/static/install_ubuntu_16.04.sh | tee log
#

# ---------------------- Install options ------------------------

# Set this to the install prefix for compiled dependencies.  If only the root
# user can write to this directory, then you will have to run this script with
# "sudo".
PREFIX=/opt/toast

# Set this to the unix group that should own the final installed software.
# If empty, it will not be changed.
CHGRP=""

# Set this to the permissions string that should be used on the final installed
# software.  If empty, it will not be changed.  This default ensures that no
# one can change the installed files without first restoring write permission.
CHMOD="a-w,a+rX"

# ------------- Install dependencies provided by the OS. ---------------
#
# Use APT to get everything we can.  Alternatively, you could provide the
# python packages here by installing Anaconda.
#

sudo apt-get update

sudo apt-get install -y curl procps build-essential gfortran git subversion \
    autoconf automake libtool m4 cmake locales libgl1-mesa-glx xvfb \
    libfftw3-dev \
    libopenblas-dev \
    libcfitsio-dev \
    libhdf5-dev \
    mpich \
    libmpich-dev \
    python3 \
    libpython3-dev \
    python3-pip \
    python3-nose \
    python3-numpy \
    python3-scipy \
    python3-matplotlib \
    python3-yaml \
    python3-h5py

# ------------------- Set up install prefix ------------------------
#
# Much of this stuff is not strictly necessary- it is just making the
# software nicer to load into user shell environments.
#

# Create the prefix directories

mkdir -p "${PREFIX}/lib"
mkdir -p "${PREFIX}/bin"
mkdir -p "${PREFIX}/include"
mkdir -p "${PREFIX}/etc"
pushd "${PREFIX}"
if [ ! -e lib64 ]; then
    ln -s lib lib64
fi
popd > /dev/null

# In the ${PREFIX}/etc directory above, create a small shell file which will
# load all this software into a user's environment.

ENV_FILE="${PREFIX}/etc/toast_env.sh"

# What is the name of our python site-packages directory?
PYSITE=$(python3 --version 2>&1 | awk '{print $2}' | sed -e "s#\(.*\)\.\(.*\)\..*#\1.\2#")

echo "# Load TOAST dependencies into the environment" > "${ENV_FILE}"

echo "export PATH=\"${PREFIX}/bin:${PATH}\"" >> "${ENV_FILE}"
echo "export CPATH=\"${PREFIX}/include:${CPATH}\"" >> "${ENV_FILE}"
echo "export LIBRARY_PATH=\"${PREFIX}/lib:${LIBRARY_PATH}\"" >> "${ENV_FILE}"
echo "export LD_LIBRARY_PATH=\"${PREFIX}/lib:${LD_LIBRARY_PATH}\"" >> "${ENV_FILE}"
echo "export PYTHONPATH=\"${PREFIX}/lib/python${PYSITE}:${PATH}\"" >> "${ENV_FILE}"
echo "" >> "${ENV_FILE}"

# Load this shell snippet now, to put the prefix into our search paths

. "${ENV_FILE}"

# -------------- Install other required software  --------------------
#
# These are required packages where we would really like to have the
# latest stable versions (i.e. not from the OS package manager).
#

# Use pip where possible to install packages into our separate prefix.
# Note that this will pull in other updated dependencies, but we are
# putting this into our own prefix (not /usr), so it is fine.  One could
# also use a virtualenv or install these via anaconda if you were using
# anaconda already to provide python3.

pip3 install --target="${PREFIX}/lib/python${PYSITE}" healpy

pip3 install --target="${PREFIX}/lib/python${PYSITE}" ephem

# Install Latest mpi4py.  We want to build this ourselves so that it uses the
# MPI version we have installed (MPICH or OpenMPI).  We also need a version
# >= 2.0 so that we can pass the communicator between python and C++.

 curl -SL https://pypi.python.org/packages/31/27/1288918ac230cc9abc0da17d84d66f3db477757d90b3d6b070d709391a15/mpi4py-3.0.0.tar.gz#md5=bfe19f20cef5e92f6e49e50fb627ee70 \
    | tar xzf - \
    && cd mpi4py-3.0.0 \
    && python3 setup.py install --prefix="${PREFIX}" \
    && cd .. \
    && rm -rf mpi4py*

#--------------------- Optional dependecies ---------------------
#
# Although not strictly required, these packages enable important
# features, such as destriping map-making, 4Pi beam convolution,
# atmosphere simulation and bandpass integration.
#

# Where is this script located, so we can find any patch files?

pushd $(dirname $0) > /dev/null
SDIR=$(pwd)
popd > /dev/null

# Install latest libmadam

 curl -SL https://github.com/hpc4cmb/libmadam/releases/download/0.2.7/libmadam-0.2.7.tar.bz2 \
    | tar -xjf - \
    && cd libmadam-0.2.7 \
    && FC="mpifort" MPIFC="mpifort" FCFLAGS="-O3 -fPIC -pthread" \
    CC="mpicc" MPICC="mpicc" CFLAGS="-O3 -fPIC -pthread" \
    ./configure  --with-cfitsio="/usr" \
    --with-blas="-lopenblas" --with-lapack="" \
    --with-fftw="/usr" --prefix="${PREFIX}" \
    && make -j 4 && make install \
    && cd .. \
    && rm -rf libmadam*

# Install conviqt

 curl -SL https://www.dropbox.com/s/4tzjn9bgq7enkf9/libconviqt-1.0.2.tar.bz2?dl=0 \
    | tar -xjf - \
    && cd libconviqt-1.0.2 \
    && CC="mpicc" CXX="mpicxx" MPICC="mpicc" MPICXX="mpicxx" \
    CFLAGS="-O3 -fPIC -pthread -std=gnu99" CXXFLAGS="-O3 -fPIC -pthread" \
    ./configure  --with-cfitsio="/usr" --prefix="${PREFIX}" \
    && make -j 4 && make install \
    && cd .. \
    && rm -rf libconviqt*

# Install elemental

 curl -SL https://github.com/elemental/Elemental/archive/v0.87.7.tar.gz \
    | tar -xzf - \
    && cd Elemental-0.87.7 \
    && mkdir build && cd build \
    && cmake \
    -D CMAKE_INSTALL_PREFIX="${PREFIX}" \
    -D INSTALL_PYTHON_PACKAGE=OFF \
    -D CMAKE_CXX_COMPILER="mpicxx" \
    -D CMAKE_C_COMPILER="mpicc" \
    -D CMAKE_Fortran_COMPILER="mpifort" \
    -D MPI_CXX_COMPILER="mpicxx" \
    -D MPI_C_COMPILER="mpicc" \
    -D MPI_Fortran_COMPILER="mpifort" \
    -D METIS_GKREGEX=ON \
    -D EL_DISABLE_PARMETIS=TRUE \
    -D MATH_LIBS="$(echo ' -lopenblas' | sed -e 's#^ ##g')" \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_CXX_FLAGS="-O3 -fPIC -pthread -fopenmp" \
    -D CMAKE_C_FLAGS="-O3 -fPIC -pthread -fopenmp" \
    -D CMAKE_Fortran_FLAGS="-O3 -fPIC -pthread -fopenmp" \
    -D CMAKE_SHARED_LINKER_FLAGS="-fopenmp" \
    .. \
    && make -j 4 && make install \
    && cd ../.. \
    && rm -rf Elemental*

# Install libsharp

 git clone https://github.com/Libsharp/libsharp --branch master --single-branch --depth 1 \
    && cd libsharp \
    && patch -p1 < "${SDIR}/../rules/patch_libsharp" \
    && autoreconf \
    && CC="mpicc" CFLAGS="-O3 -fPIC -pthread" \
    ./configure  --enable-mpi --enable-pic --prefix="${PREFIX}" \
    && make \
    && cp -a auto/* "${PREFIX}" \
    && cd python \
    && LIBSHARP="${PREFIX}" CC="mpicc -g" LDSHARED="mpicc -g -shared" \
    python3 setup.py install --prefix="${PREFIX}" \
    && cd ../.. \
    && rm -rf libsharp*

# Install PySM

 git clone https://github.com/zonca/PySM_public.git --branch megarun_2017 --single-branch --depth 1 \
    && cd PySM_public \
    && python3 setup.py install --prefix="${PREFIX}" \
    && cd .. \
    && rm -rf PySM*

# Install aatm

 curl -SL https://launchpad.net/aatm/trunk/0.5/+download/aatm-0.5.tar.gz \
    | tar xzf - \
    && cd aatm-0.5 \
    && chmod -R u+w . \
    && patch -p1 < "${SDIR}/../rules/patch_aatm" \
    && autoreconf \
    && CC="gcc" CFLAGS="-O3 -fPIC -pthread" \
    CPPFLAGS="-I${PREFIX}/include" \
    LDFLAGS="-L${PREFIX}/lib" \
    ./configure  \
    --prefix="${PREFIX}" \
    && make -j 4 && make install \
    && cd .. \
    && rm -rf aatm*

# Make sure that any python modules installed to our prefix are built into pyc
# files- so that we can make those directories read-only

python3 -m compileall -f "${PREFIX}/lib/python${PYSITE}/site-packages"

# Set permissions

if [ "x${CHGRP}" != "x" ]; then
    chgrp -R ${CHGRP} "${PREFIX}"
fi

if [ "x${CHMOD}" != "x" ]; then
    chmod -R ${CHMOD} "${PREFIX}"
fi

error: pathspec 'external/static/install_ubuntu_16.04.sh' did not match any file(s) known to git