Houdini setup script for the Fish shell

I use the Fish shell and also dabble in Houdini. Because Fish is uncommon and have its own unique syntax, I had to create a Houdini setup script for the Fish shell. In the hopes of others finding it useful, here it is in all its entirety:
#
#   Environment setup script for Houdini.
#
#   To use this script you should "cd" to the hfs directory where this
#   script is located and "source" it into your bash shell or from your
#   .profile script.
#
#   Alternatively you may copy this script, remove the first if
#   statement and change the setting of the "HFS" variable to be
#   the location of your installed Houdini hfs directory.
#
#   Note that this script modifies your search path by inserting the
#   Houdini bin directory at the beginning. It may also sets the environment
#   variable LD_LIBRARY_PATH which is used to search for runtime libraries.
#
#   To run the script in quiet mode, specify the "-q" option on the
#   command line.
#
if [ ! -d houdini  -o  ! -d dsolib  -o  ! -d bin ]
    echo "You must cd to the Houdini installation directory before"
    echo "sourcing this script. This allows the script to determine"
    echo "the installed location."
else
    set -gx HFS "$PWD"

    #
    #  The following are some handy shortcuts:
    #
    set -gx H "$HFS"
    set -gx HB "$H/bin"
    set -gx HDSO "$H/dsolib"
    set -gx HH "$H/houdini"
    set -gx HHC "$HH/config"
    set -gx HHP "$HH/python3.11libs"
    set -gx HT "$H/toolkit"
    set -gx HSB "$HH/sbin"

    #
    #  The following is used as the generic /tmp path.  This is also
    # set on Windows to the temporary directory, so can be used for
    # system independent .hip files.
    #
    set -gx TEMP /tmp

    #
    # Look for java.
    #
    if [ "$JAVA_HOME" = "" ]
        # Check in PATH first
        set -l d (which java 2>&1)
        if [ "$status" = "0" ]
            set -gx JAVA_HOME (echo "$d" | sed 's/\/bin.*//g')
        else
            for dir in /usr/local /usr/local/java2 /usr/local/java /opt /usr /usr/java2 /usr/java
                if [ -d "$dir" ]
                    set -l d $(find "$dir" -maxdepth 3 -path "*/bin/java" -printf "%h\n" 2> /dev/null | head -1 | sed 's/\/bin//')
                    if [ "$d" ]
                        set -gx JAVA_HOME "$d"
                        break
                    end
                end
            end
        end
    end

    # We only need to set LD_LIBRARY_PATH if the environment also uses it. This
    # makes sure HDSO is always searched first. Houdini binaries are built with
    # DT_RUNPATH set so it only gets used after LD_LIBRARY_PATH.
    if [ "$LD_LIBRARY_PATH" != "" ]
        set -gx LD_LIBRARY_PATH "$HDSO:$LD_LIBRARY_PATH"
    end

    # If the java binary exists but cannot be found, then add JAVA_HOME
    # to PATH.  Otherwise, only add HB and HSB to PATH.
    set -l java_path (which java 2>&1)
    set -l which_java $status
    if [ "$JAVA_HOME" = "" -o "$which_java" = "0" ]
    set -gx PATH "$HB:$HSB:$PATH"
    else
    set -gx PATH "$HB:$HSB:$JAVA_HOME/bin:$PATH"
    end

    set -gx HOUDINI_MAJOR_RELEASE 20
    set -gx HOUDINI_MINOR_RELEASE 5
    set -gx HOUDINI_BUILD_VERSION 304
    set -gx HOUDINI_VERSION "$HOUDINI_MAJOR_RELEASE.$HOUDINI_MINOR_RELEASE.$HOUDINI_BUILD_VERSION"

    # Build machine related stuff
    set -gx HOUDINI_BUILD_KERNEL "4.18.0-513.18.1.el8_9.x86_64"
    set -gx HOUDINI_BUILD_PLATFORM "Red Hat Enterprise Linux release 8.9 (Ootpa)"
    set -gx HOUDINI_BUILD_COMPILER "11.2.1"

    # This only applies for linux systems
    set -gx HOUDINI_BUILD_LIBC "glibc 2.28"

    if [ $statusprompt ]
    if [ "$1" != "-q" ]
        echo "The Houdini $HOUDINI_VERSION environment has been initialized."
    end
    end

    #
    # These environment variables are no longer supported.
    #
    set -gx HIH "$HOME/houdini$HOUDINI_MAJOR_RELEASE.$HOUDINI_MINOR_RELEASE"
    set -gx HIS "$HH"
end

Leave a comment