Commit b76b87e1 authored by Ryan Berkheimer's avatar Ryan Berkheimer
Browse files

simplified some installation scripts; added Makefile templates for user...

simplified some installation scripts; added Makefile templates for user library building, added to install path; work on simplifying JAR contents through gradle build.
parent 95912b24
Pipeline #5807 failed with stage
in 0 seconds
......@@ -2,7 +2,7 @@ plugins {
id 'groovy'
id 'maven-publish'
id 'java'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
shadowJar {
......@@ -15,6 +15,7 @@ shadowJar {
}
}
publishing {
publications {
maven(MavenPublication) {
......@@ -39,21 +40,27 @@ publishing {
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
defaultTasks 'clean', 'rebuild','uploadShadow', 'publishToMavenLocal', 'groovydoc'
defaultTasks 'clean', 'rebuild', 'uploadShadow', 'publishToMavenLocal', 'groovydoc'
configurations {
// configuration that holds jars to include in the jar
directDeps
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}",
"commons-net:commons-net:${apacheCommonsNetVersion}",
directDeps ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}")
compile ("commons-net:commons-net:${apacheCommonsNetVersion}",
"org.codehaus.groovy:groovy-all:${groovyVersion}")
testCompile ("org.slf4j:slf4j-simple:${slf4jVersion}",
"org.spockframework:spock-core:${spockVersion}")
testRuntime ("com.athaydes:spock-reports:${spockReportsVersion}")
configurations.compile.extendsFrom(configurations.directDeps)
}
jar {
......@@ -61,6 +68,11 @@ jar {
attributes 'Implementation-Title': 'MessageAPI',
'Implementation-Version': "${messageApiVersion}"
}
/*from {
configurations.directDeps.collect {
it.isDirectory() && it.getPath().contains("json-simple") ? it : project.logger.lifecycle(it.getPath())
}
}*/
}
sourceSets {
......
......@@ -7,11 +7,11 @@ messageApiVersion = 1.0.0
#javaVersion = 11.0.3
javaVersion = 1.8
#Utils
#Runtime Deps
jsonSimpleVersion = 1.1.1
#Build
shadowVersion = 2.0.2
shadowVersion = 5.2.0
#Testing
slf4jVersion = 1.7.13
......
......@@ -18,15 +18,19 @@ REAL_NAME=$(LINKER_NAME).$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
CURRENT_DIR=$(PWD)
PROJECT_ROOT=$(firstword $(subst /scripts/build/c/main, ,$(CURRENT_DIR)))
#Set target directoies
#Set target directories
BUILD_DIR=$(PROJECT_ROOT)/build/c/main
SRC_DIR=$(BUILD_DIR)/src
COMPILE_DIR=$(BUILD_DIR)/compile
HEADER_DIR=$(BUILD_DIR)/headers
LIB_DIR=$(BUILD_DIR)/libs
TEMPLATE_DIR=$(BUILD_DIR)/templates
ARTIFACT_DIR=$(PROJECT_ROOT)/dist/artifacts/c/$(LIBRARY_NAME)_$(MAJOR_VERSION)_$(MINOR_VERSION)_$(PATCH_VERSION)
#Source Template Directory
TEMPLATE_SRC_DIR=$(PROJECT_ROOT)/scripts/build/c/templates
#Include Paths for JNI (dependent on Java Home being set)
JNI_H_DIR=$(JAVA_HOME)/include
JNIMD_H_DIR=$(JAVA_HOME)/include/linux
......@@ -96,7 +100,7 @@ all: check_sys prep build link dist clean
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS not linux. Terminating."
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
......@@ -111,6 +115,7 @@ prep:
@mkdir -p $(COMPILE_DIR)
@mkdir -p $(HEADER_DIR)
@mkdir -p $(LIB_DIR)
@mkdir -p $(TEMPLATE_DIR)
@mkdir -p $(ARTIFACT_DIR)
......@@ -149,8 +154,9 @@ dist:
@cp $(CPP_FQ_FULL_H_FILES) $(HEADER_DIR)
@cp $(CPP_FQ_SRC_FILES) $(SRC_DIR)
@cp $(CPP_FQ_FULL_SRC_FILES) $(SRC_DIR)
@cp $(TEMPLATE_SRC_DIR)/Makefile.* $(TEMPLATE_DIR)
@echo "Building tarfile for distribution."
@-cd $(BUILD_DIR) && tar -cf $(LIBRARY_NAME).tar src libs headers install.sh
@-cd $(BUILD_DIR) && tar -cf $(LIBRARY_NAME).tar src libs headers templates install.sh
@echo "Moving tarfile to $(ARTIFACT_DIR)."
@-cd $(BUILD_DIR) && mv $(LIBRARY_NAME).tar $(ARTIFACT_DIR)
@echo "Finished build, artifacts are now tarred and available in $(ARTIFACT_DIR)."
......
### This Makefile can be used as a template for writing MessageAPI compatible C/C++ Endpoints that extend the
# NativeEndpoint.
# Note that the goal of native endpoint production is to create a shared library,
# as shared libraries are used by the Java code. Once produced, the fully-qualified shared library should just be referenced in the
# config map for the endpoint itself. If you are reading this, you most likely understand what is necessary, but if not, see the example
# 'native endpoint' in the MessageAPI source code 'test' namespace with associated parameter map.
# The majority of this Makefile is standard, with only six user specified variables. These are denoted by the comment USER SPECIFIED.
# All user specified variables are at the top of this makefile. The build process is standardized to automatically include MessageAPI resources,
# So if there is an issue at first, make sure you have installed the library correctly (need $MESSAGEAPI_SRC and $MESSAGEAPI_HEADERS env vars).
# There are a few other system-specific requirements and other notable things to keep in mind when using this Makefile:
## 1. You must have a JDK installed (not JRE). This library requires the jni.h and jnimd.h headers included in your jdk.
## 2. JAVA_HOME must be set to your JDK home directory (one level above the java binary). This Makefile references JAVA_HOME in looking for jni.h and jnimd.h
#USER SPECIFIED - Specify where the library will build to. The library itself will be placed in $BUILD_DIR/compile
BUILD_DIR=
#USER SPECIFIED - Specify the base name of the lib (e.g., if lib to be built as libMyEndpoint.so, put MyEndpoint here)
LIBRARY_NAME=
#USER SPECIFIED - Specify The next two lines with Fully Qualified paths to your C source (if any) and headers (if any) in dependency order.
#he last C file should correspond to the Messageapi endpoint wrapper (the header is in the $MESSAGEAPI_HEADERS dir and is auto-included).
#This C file is the entry point for the library. See $MESSAGEAPI_HEADERS/gov_noaa_messageapi_endpoints_NativeEndpoint.h for the signature of
#the class that must be wrapped.
USER_C_SRC_FILES=
USER_C_H_FILES=
#USER SPECIFIED - Specify The next two lines with Fully Qualified paths to your C++ source (if any) and headers (if any) in dependency order.
USER_CPP_SRC_FILES=
USER_CPP_H_FILES=
############### The next sections are usually default. You can also contact the MessageAPI maintainers for help if there are issues. ###################
COMPILE_DIR=$(BUILD_DIR)/compile#.o and .so files produced here
HEADER_DIR=$(BUILD_DIR)/headers#.h files copied here before build (for central include path)
SO_NAME=lib$(LIBRARY_NAME).so
#The following represent directories for JNI Libraries that must be included during C and CPP compilation.
#The following represent a standard RHEL 7/8 system with OpenJDK.
JNIDIR=$(JAVA_HOME)/include
JNIMDDIR=$(JAVA_HOME)/include/linux
#compilers
CXX=g++
CC=gcc
MAPI_C_H_FILES=/messageapi_structs.h /gov_noaa_messageapi_endpoints_NativeEndpoint.h
MAPI_C_FQ_H_FILES=$(addprefix $(MESSAGEAPI_HEADERS), $(MAPI_C_H_FILES))
MAPI_CPP_SRC_FILES=/JniUtils.cpp /TypeUtils.cpp /MapUtils.cpp \
/ListUtils.cpp /ConditionUtils.cpp /FieldUtils.cpp \
/EndpointUtils.cpp /ProtocolRecordUtils.cpp /RecordUtils.cpp \
/RejectionUtils.cpp /PacketUtils.cpp \
/MessageApiEndpoint.cpp /MessageApiEndpointLib.cpp
MAPI_CPP_FQ_SRC_FILES=$(addprefix $(MESSAGEAPI_SRC), $(MAPI_CPP_SRC_FILES))
MAPI_CPP_H_FILES=/JniUtils.h /TypeUtils.h /MapUtils.h \
/ListUtils.h /ConditionUtils.h /FieldUtils.h \
/EndpointUtils.h /ProtocolRecordUtils.h /RecordUtils.h \
/RejectionUtils.h /PacketUtils.h \
/MessageApiEndpoint.h /MessageApiEndpointLib.h
MAPI_CPP_FQ_H_FILES=$(addprefix $(MESSAGEAPI_SRC), $(MAPI_CPP_H_FILES))
all: check_sys prep build
.PHONY : check_sys prep build
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
prep:
@echo "Preparing system for build."
@rm -rf $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)
@mkdir -p $(COMPILE_DIR)
@mkdir -p $(HEADER_DIR)
build:
@echo "Building $(LIBRARY_NAME) as $(SO_NAME) in $(COMPILE_DIR)"
@echo "Copying all headers to include path."
@cp $(MAPI_C_FQ_H_FILES) $(HEADER_DIR)
@cp $(MAPI_CPP_FQ_H_FILES) $(HEADER_DIR)
@cp $(USER_C_H_FILES) $(HEADER_DIR)
@cp $(USER_CPP_H_FILES) $(HEADER_DIR)
@echo "Compiling C++ object files with position independent code."
@echo ""
@-cd $(COMPILE_DIR) && $(CXX) -I$(HEADER_DIR) -I$(JNIDIR) -I$(JNIMDDIR) -fPIC -c $(MAPI_CPP_FQ_SRC_FILES) $(USER_CPP_SRC_FILES)
@echo ""
@echo "Compiling C object files with position independent code."
@echo ""
@-cd $(COMPILE_DIR) && $(CC) -I$(HEADER_DIR) -I$(JNIDIR) -I$(JNIMDDIR) -fPIC -std=c99 -c $(MAPI_C_FQ_SRC_FILES) $(USER_C_SRC_FILES)
@echo ""
@echo "Creating shared library."
@echo ""
@-cd $(COMPILE_DIR) && $(CXX) -shared -fPIC -std=c99 *.o -o $(SO_NAME)
@echo "Build success for $(LIBRARY_NAME) as $(COMPILE_DIR)/$(SO_NAME)"
\ No newline at end of file
### This Makefile can be used as a template for writing programs that use that use the MessageAPI session shared library.
# Note that the goal of this makefile is to provide a template that can produce C/C++ programs (not shared libraries). It will
# provide access to the MessageAPI shared library during build.
# Note that this library does not package the messageapi .so or .so dependencies of the MessageAPI lib (libjli and libjvm).
# When DEPLOYING a program that uses the MessageAPI library to a new system, either the LD_LIBRARY_PATH environment variable should be set/exported with the
# locations of libjli.so, libjvm.so, and libmessageapi.so, or they should be installed to the standard location for libs (if root).
# For the purposes of this build (on the build system), if MessageAPI was installed,
# the LD_LIBRARY_PATH should already be set in the users .bashrc. If there is an issue
# with linking, please contact the MessageAPI maintainers for assistance.
# The majority of this Makefile is standard, with only 4 user specified variables. These are denoted by the comment USER SPECIFIED.
# All user specified variables are at the top of this makefile. The build process is standardized to automatically include MessageAPI resources,
# So if there is an issue at first, make sure you have installed the library correctly (need $MESSAGEAPI_LIBS and $MESSAGEAPI_HEADERS env vars).
# There are a few other system-specific requirements and other notable things to keep in mind when using this Makefile:
## 1. You must have a JDK installed (not JRE). Building something with messageapi also requires the jni.h and jnimd.h headers included in your jdk.
## 2. JAVA_HOME must be set to your JDK home directory (one level above the java binary). This Makefile references JAVA_HOME in looking for jni.h and jnimd.h
#USER SPECIFIED: Enter the name of your program binary (e.g., MySession.bin)
PROGRAM_NAME=
#USER SPECIFIED: Enter the name of the build dir. The project will be built in
BUILD_DIR=
#USER SPECIFIED: Enter the fully qualified paths of your source files and header files here:
SRC_FILES=
H_FILES=
########################## Everything below here is fairly standardized. Usually no need to adjust below unless there is an issue.############
COMPILE_DIR=$(BUILD_DIR)/compile#.o files and program binary produced here
HEADER_DIR=$(BUILD_DIR)/headers#.h files copied here before build (for central include path)
DEPS_DIR=$(BUILD_DIR)/deps#copy the messageapi lib here before build.
#The following represent directories for JNI Libraries that must be included during C and CPP compilation.
#The following represent a standard RHEL 7/8 system with OpenJDK.
JNIDIR=$(JAVA_HOME)/include
JNIMDDIR=$(JAVA_HOME)/include/linux
#compilers
CC=gcc
all: check_sys prep copy-shared build
.PHONY : check_sys prep copy-shared build clean
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
prep:
@echo "Preparing system for build."
@rm -rf $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)
@mkdir -p $(COMPILE_DIR)
@mkdir -p $(HEADER_DIR)
@mkdir -p $(DEPS_DIR)
@echo "Finished preparing system for build."
copy-shared:
@echo "Extracting and copying production artifacts as shared resources for build."
@cp $(MESSAGEAPI_LIBS)/* $(DEPS_DIR)
@cp $(H_FILES) $(HEADER_DIR)
@echo "Finished copying resources."
build:
@echo "Building $(PROGRAM_NAME) in $(COMPILE_DIR)"
@echo "Compiling C and/or C++ object files with position independent code."
@-cd $(COMPILE_DIR) && $(CC) -fPIC -std=c99 -I$(MESSAGEAPI_HEADERS) -I$(HEADER_DIR) -I$(JNIDIR) -I$(JNIMDDIR) -L$(DEPS_DIR) -Wl,-rpath,$(DEPS_DIR) -lmessageapi $(SRC_FILES) -o $(PROGRAM_NAME)
@echo "Completed build of $(COMPILE_DIR)/$(PROGRAM_NAME)."
clean:
@echo "Cleaning up build refuse."
@rm -rf $(BUILD_DIR)
@echo "Finished cleaning up build refuse."
\ No newline at end of file
### This Makefile can be used as a template for writing MessageAPI compatible C/C++ transformations that extend the
# NativeTransformation.
# Note that the goal of native transformation production is to create a shared library,
# as shared libraries are used by the Java code. Once produced, the fully-qualified shared library should just be referenced in the
# config map for the transformation itself. If you are reading this, you most likely understand what is necessary, but if not, see the example
# 'native transformation' in the MessageAPI source code 'test' namespace with associated parameter map.
# The majority of this Makefile is standard, with only six user specified variables. These are denoted by the comment USER SPECIFIED.
# All user specified variables are at the top of this makefile. The build process is standardized to automatically include MessageAPI resources,
# So if there is an issue at first, make sure you have installed the library correctly (need $MESSAGEAPI_SRC and $MESSAGEAPI_HEADERS env vars).
# There are a few other system-specific requirements and other notable things to keep in mind when using this Makefile:
## 1. You must have a JDK installed (not JRE). This library requires the jni.h and jnimd.h headers included in your jdk.
## 2. JAVA_HOME must be set to your JDK home directory (one level above the java binary). This Makefile references JAVA_HOME in looking for jni.h and jnimd.h
#USER SPECIFIED - Specify where the library will build to. The library itself will be placed in $BUILD_DIR/compile
BUILD_DIR=
#USER SPECIFIED - Specify the base name of the lib (e.g., if lib to be built as libMyTransformation.so, put MyTransformation here)
LIBRARY_NAME=
#USER SPECIFIED - Specify The next two lines with Fully Qualified paths to your C source (if any) and headers (if any) in dependency order.
#he last C file should correspond to the Messageapi endpoint wrapper (the header is in the $MESSAGEAPI_HEADERS dir and is auto-included).
#This C file is the entry point for the library. See $MESSAGEAPI_HEADERS/gov_noaa_messageapi_transformations_NativeTransformation.h for the signature of
#the class that must be wrapped.
USER_C_SRC_FILES=
USER_C_H_FILES=
#USER SPECIFIED - Specify The next two lines with Fully Qualified paths to your C++ source (if any) and headers (if any) in dependency order.
USER_CPP_SRC_FILES=
USER_CPP_H_FILES=
############### The next sections are usually default. You can also contact the MessageAPI maintainers for help if there are issues. ###################
COMPILE_DIR=$(BUILD_DIR)/compile#.o and .so files produced here
HEADER_DIR=$(BUILD_DIR)/headers#.h files copied here before build (for central include path)
SO_NAME=lib$(LIBRARY_NAME).so
#The following represent directories for JNI Libraries that must be included during C and CPP compilation.
#The following represent a standard RHEL 7/8 system with OpenJDK.
JNIDIR=$(JAVA_HOME)/include
JNIMDDIR=$(JAVA_HOME)/include/linux
#compilers
CXX=g++
CC=gcc
MAPI_C_H_FILES=/messageapi_structs.h /gov_noaa_messageapi_transformations_NativeTransformation.h
MAPI_C_FQ_H_FILES=$(addprefix $(MESSAGEAPI_HEADERS), $(MAPI_C_H_FILES))
MAPI_CPP_SRC_FILES=/JniUtils.cpp /TypeUtils.cpp /MapUtils.cpp \
/ListUtils.cpp /ConditionUtils.cpp /FieldUtils.cpp \
/TransformationUtils.cpp /RecordUtils.cpp \
/RejectionUtils.cpp /PacketUtils.cpp \
/MessageApiTransformation.cpp /MessageApiTransformationLib.cpp
MAPI_CPP_FQ_SRC_FILES=$(addprefix $(MESSAGEAPI_SRC), $(MAPI_CPP_SRC_FILES))
MAPI_CPP_H_FILES=/JniUtils.h /TypeUtils.h /MapUtils.h \
/ListUtils.h /ConditionUtils.h /FieldUtils.h \
/TransformationUtils.h /RecordUtils.h \
/RejectionUtils.h /PacketUtils.h \
/MessageApiTransformation.h /MessageApiTransformationLib.h
MAPI_CPP_FQ_H_FILES=$(addprefix $(MESSAGEAPI_SRC), $(MAPI_CPP_H_FILES))
all: check_sys prep build
.PHONY : check_sys prep build
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
prep:
@echo "Preparing system for build."
@rm -rf $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)
@mkdir -p $(COMPILE_DIR)
@mkdir -p $(HEADER_DIR)
build:
@echo "Building $(LIBRARY_NAME) as $(SO_NAME) in $(COMPILE_DIR)"
@echo "Copying all headers to include path."
@cp $(MAPI_C_FQ_H_FILES) $(HEADER_DIR)
@cp $(MAPI_CPP_FQ_H_FILES) $(HEADER_DIR)
@cp $(USER_C_H_FILES) $(HEADER_DIR)
@cp $(USER_CPP_H_FILES) $(HEADER_DIR)
@echo "Compiling C++ object files with position independent code."
@echo ""
@-cd $(COMPILE_DIR) && $(CXX) -I$(HEADER_DIR) -I$(JNIDIR) -I$(JNIMDDIR) -fPIC -c $(MAPI_CPP_FQ_SRC_FILES) $(USER_CPP_SRC_FILES)
@echo ""
@echo "Compiling C object files with position independent code."
@echo ""
@-cd $(COMPILE_DIR) && $(CC) -I$(HEADER_DIR) -I$(JNIDIR) -I$(JNIMDDIR) -fPIC -std=c99 -c $(MAPI_C_FQ_SRC_FILES) $(USER_C_SRC_FILES)
@echo ""
@echo "Creating shared library."
@echo ""
@-cd $(COMPILE_DIR) && $(CXX) -shared -fPIC -std=c99 *.o -o $(SO_NAME)
@echo "Build success for $(LIBRARY_NAME) as $(COMPILE_DIR)/$(SO_NAME)"
\ No newline at end of file
......@@ -19,9 +19,9 @@ PROJECT_ROOT=$(firstword $(subst /scripts/build/c/test, ,$(CURRENT_DIR)))
#Set target directories - this is where the library will build from/to.
BUILD_DIR=$(PROJECT_ROOT)/build/c/test/endpoint
COMPILE_DIR=$(BUILD_DIR)/compile #.o files produced here
HEADER_DIR=$(BUILD_DIR)/headers #.h files copied here before build (for central include path)
LIB_DIR=$(PROJECT_ROOT)/libs/test/c/endpoint #.so moved here before test
COMPILE_DIR=$(BUILD_DIR)/compile#.o files produced here
HEADER_DIR=$(BUILD_DIR)/headers#.h files copied here before build (for central include path)
LIB_DIR=$(PROJECT_ROOT)/libs/test/c/endpoint#.so moved here before test
#The following var represents the base name of the shared .so library that will be created and referenced in the job map.
......@@ -71,7 +71,7 @@ all: check_sys prep build
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS not linux. Terminating."
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
......
......@@ -61,7 +61,7 @@ all: check_sys prep copy-shared build clean
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS not linux. Terminating."
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
......
......@@ -19,9 +19,9 @@ PROJECT_ROOT=$(firstword $(subst /scripts/build/c/test, ,$(CURRENT_DIR)))
#Set target directories - this is where the library will build from/to.
BUILD_DIR=$(PROJECT_ROOT)/build/c/test/transformation
COMPILE_DIR=$(BUILD_DIR)/compile #.o files produced here
HEADER_DIR=$(BUILD_DIR)/headers #.h files copied here before build (for central include path)
LIB_DIR=$(PROJECT_ROOT)/libs/test/c/transformation #.so moved here before test
COMPILE_DIR=$(BUILD_DIR)/compile#.o files produced here
HEADER_DIR=$(BUILD_DIR)/headers#.h files copied here before build (for central include path)
LIB_DIR=$(PROJECT_ROOT)/libs/test/c/transformation#.so moved here before test
#The following var represents the base name of the shared .so library that will be created and referenced in the job map.
......@@ -71,7 +71,7 @@ all: check_sys prep build
check_sys:
@echo "Checking OS type"
ifneq ($(shell uname),Linux)
@echo "This makefile is for building shared libraries on linux, OS not linux. Terminating."
@echo "This makefile is for building shared libraries on linux, OS is $(shell uname). Terminating."
@exit 1
endif
@echo "System OS is Linux, continuing build."
......
......@@ -17,11 +17,11 @@ update_ld_library_paths () {
java_jvm=$(cd "${java_lib}" && cd server && echo "${PWD}")
if [[ -n $java_jli && -n $java_jvm ]]; then
echo "Updating LD_LIBRARY_PATH with locations for libjli and libjvm in bashrc."
sed '/#messageapi_jvm_ld_library_path/d' "${HOME}/.bashrc" > "${HOME}/.bashrc_tmp"
mv "${HOME}/.bashrc_tmp" "${HOME}/.bashrc"
echo "export LD_LIBRARY_PATH=${java_jli}:${java_jvm}:$LD_LIBRARY_PATH #messageapi_jvm_ld_library_path" >> "${HOME}/.bashrc"
sed '/#messageapi_jvm_ld_library_path/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export LD_LIBRARY_PATH=${java_jli}:${java_jvm}:$LD_LIBRARY_PATH #messageapi_jvm_ld_library_path" >> "${BASHRC}"
export LD_LIBRARY_PATH=${java_jli}:${java_jvm}:$LD_LIBRARY_PATH
echo "Successfully updated LD_LIBRARY_PATH in ${HOME}/.bashrc"
echo "Successfully updated LD_LIBRARY_PATH in ${BASHRC}"
else
echo "Could not find the libjli or libjvm folders. C/C++ lib will not work correctly."
echo "Please contact messageapi maintainers for help, it appears you have a non-supported java setup."
......@@ -40,10 +40,10 @@ update_ld_library_paths () {
update_headers_var () {
echo ""
echo "Updating the MESSAGEAPI_HEADERS environment variable in $(whoami)'s ~/.bashrc."
sed '/#messageapi_c_cpp_set_headers/d' "${HOME}/.bashrc" > "${HOME}/.bashrc_tmp"
mv "${HOME}/.bashrc_tmp" "${HOME}/.bashrc"
echo "MESSAGEAPI_HEADERS=${HEADERS_INSTALL_DIR} #messageapi_c_cpp_set_headers" >> "${HOME}/.bashrc"
echo "Added a 'MESSAGEAPI_HEADERS' environment variable to ${HOME}/.bashrc for convenient inclusion of library headers."
sed '/#messageapi_c_cpp_set_headers/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export MESSAGEAPI_HEADERS=${HEADERS_INSTALL_DIR} #messageapi_c_cpp_set_headers" >> "${BASHRC}"
echo "Added a 'MESSAGEAPI_HEADERS' environment variable to ${BASHRC} for convenient inclusion of library headers."
echo "When creating a C/C++ session, endpoint, condition, or transformation, you can use the MESSAGEAPI_HEADERS as the include location."
echo "Build file templates for each of these is provided in the templates directory, accessible via the MESSAGEAPI_TEMPLATES environment variable."
echo ""
......@@ -52,14 +52,14 @@ update_headers_var () {
update_libs_var () {
echo ""
echo "Updating the MESSAGEAPI_LIBS environment variable in $(whoami)'s ~/.bashrc."
sed '/#messageapi_c_cpp_set_libs/d' "${HOME}/.bashrc" > "${HOME}/.bashrc_tmp"
mv "${HOME}/.bashrc_tmp" "${HOME}/.bashrc"
echo "export MESSAGEAPI_LIBS=${LIBS_INSTALL_DIR} #messageapi_c_cpp_set_libs" >> "${HOME}/.bashrc"
sed '/#messageapi_c_cpp_set_libs/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export MESSAGEAPI_LIBS=${LIBS_INSTALL_DIR} #messageapi_c_cpp_set_libs" >> "${BASHRC}"
export MESSAGEAPI_LIBS=${LIBS_INSTALL_DIR}
sed '/#messageapi_c_cpp_ld_library_path/d' "${HOME}/.bashrc" > "${HOME}/.bashrc_tmp"
mv "${HOME}/.bashrc_tmp" "${HOME}/.bashrc"
echo "export LD_LIBRARY_PATH=${MESSAGEAPI_LIBS}:${LD_LIBRARY_PATH} #messageapi_c_cpp_ld_library_path" >> "${HOME}/.bashrc"
echo "Added a 'MESSAGEAPI_LIBS' environment variable to ${HOME}/.bashrc for convenient inclusion of the C/C++ shared library."
sed '/#messageapi_c_cpp_ld_library_path/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export LD_LIBRARY_PATH=${MESSAGEAPI_LIBS}:${LD_LIBRARY_PATH} #messageapi_c_cpp_ld_library_path" >> "${BASHRC}"
echo "Added a 'MESSAGEAPI_LIBS' environment variable to ${BASHRC} for convenient inclusion of the C/C++ shared library."
echo "Updated the LD_LIBRARY_PATH environment variable to include the MESSAGEAPI_LIBS path."
echo "When creating a C/C++ program that uses the MessageAPI session library, you can use the MESSAGEAPI_LIBS as the linking location."
echo ""
......@@ -68,15 +68,27 @@ update_libs_var () {
update_src_var () {
echo ""
echo "Updating the MESSAGEAPI_SRC environment variable in $(whoami)'s ~/.bashrc."
sed '/#messageapi_c_cpp_set_src/d' "${HOME}/.bashrc" > "${HOME}/.bashrc_tmp"
mv "${HOME}/.bashrc_tmp" "${HOME}/.bashrc"
echo "export MESSAGEAPI_SRC=${SRC_INSTALL_DIR} #messageapi_c_cpp_set_src" >> "${HOME}/.bashrc"
echo "Added a 'MESSAGEAPI_SRC' environment variable to ${HOME}/.bashrc for convenient inclusion of the C/C++ source files."
sed '/#messageapi_c_cpp_set_src/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export MESSAGEAPI_SRC=${SRC_INSTALL_DIR} #messageapi_c_cpp_set_src" >> "${BASHRC}"
echo "Added a 'MESSAGEAPI_SRC' environment variable to ${BASHRC} for convenient inclusion of the C/C++ source files."
echo "When creating a C/C++ session, endpoint, condition, or transformation, you can use the MESSAGEAPI_SRC for base source paths during build."
echo "Build file templates for each of these is provided in the templates directory, accessible via the MESSAGEAPI_TEMPLATES environment variable."
echo ""
}
update_template_var () {
echo ""
echo "Updating the MESSAGEAPI_TEMPLATES environment variable in $(whoami)'s ~/.bashrc."
sed '/#messageapi_c_cpp_build_templates/d' "${BASHRC}" > "${BASHRC_TMP}"
mv "${BASHRC_TMP}" "${BASHRC}"
echo "export MESSAGEAPI_TEMPLATES=${TEMPLATE_INSTALL_DIR} #messageapi_c_cpp_build_templates" >> "${BASHRC}"
echo "Added a 'MESSAGEAPI_TEMPLATES' environment variable to ${BASHRC} for convenient access to the C/C++ build templates."
echo "These templates are set up to use the installation paths for messageapi source code, libraries, and headers."
echo "To use them, copy the template to your desired build location, fill out the fields with USER FIELD comments, and run 'make'."
echo ""
}
install_headers () {
echo ""
echo "Installing messageapi C/C++ headers to ${HEADERS_INSTALL_DIR}."
......@@ -107,13 +119,28 @@ install_src () {
echo ""
}
LIBS_INSTALL_DIR=${HOME}/.messageapi/c/libs
HEADERS_INSTALL_DIR=${HOME}/.messageapi/c/headers
SRC_INSTALL_DIR=${HOME}/.messageapi/c/src
install_templates () {
echo ""
echo "Installing messageapi C/C++ build templates to ${TEMPLATE_INSTALL_DIR}."
rm -rf "${TEMPLATE_INSTALL_DIR}"
mkdir -p "${TEMPLATE_INSTALL_DIR}"
cp templates/* "${TEMPLATE_INSTALL_DIR}"
echo "Finished installing messageapi C/C++ build templates to ${TEMPLATE_INSTALL_DIR}."
echo ""
}
BASHRC=${HOME}/.bashrc
BASHRC_TMP=${HOME}/.bashrc_tmp
INSTALL_DIR=${HOME}/.messageapi/c
LIBS_INSTALL_DIR=${INSTALL_DIR}/libs
HEADERS_INSTALL_DIR=${INSTALL_DIR}/headers
SRC_INSTALL_DIR=${INSTALL_DIR}/src
TEMPLATE_INSTALL_DIR=${INSTALL_DIR}/templates
#Main Body
echo ""
echo "Installing the MessageAPI C/C++ libs, headers, and src for the current user $(whoami)"
echo "Installing the MessageAPI C/C++ libs, headers, src, and build templates for the current user $(whoami)"
update_ld_library_paths
install_libs
update_libs_var
......@@ -121,5 +148,7 @@ install_headers
update_headers_var
install_src
update_src_var
echo "Finished installing the MessageAPI C/C++ libs, headers, and src for user $(whoami)."
install_templates
update_template_var
echo "Finished installing the MessageAPI C/C++ libs, headers, src, and build templates for user $(whoami)."