Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/zopen-build
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ Option:
python. The default is clang.
-e ENV_FILE source ENV_FILE instead of buildenv to establish
build environment.
-E, --editable enable editing of the executable (adds -Wl,-bedit=yes to LDFLAGS).
--instrument instruments the application with option -finstrument-functions (clang only)
-f, --force-rebuild forces a rebuild, including running bootstrap
and configure again.
Expand Down Expand Up @@ -387,6 +388,7 @@ processOptions()
instrument=false
printSourceDir=false
use_ccache=false
editable=false
depsDepth=2
while [ $# -gt 0 ]; do
case $1 in
Expand Down Expand Up @@ -463,6 +465,9 @@ processOptions()
shift
buildEnvFile=$1
;;
"-E" | "--editable")
editable=true
;;
"-c" | "--clean")
cleanupBuild=true
;;
Expand Down Expand Up @@ -872,6 +877,9 @@ setEnv()
fi

# Dependencies such as libraries may add flags
if ${editable}; then
ZOPEN_EXTRA_LDFLAGS="${ZOPEN_EXTRA_LDFLAGS} -Wl,-bedit=yes"
fi
export CPPFLAGS="${ZOPEN_CPPFLAGS} ${ZOPEN_EXTRA_CPPFLAGS}"
export CFLAGS="${ZOPEN_CFLAGS} ${ZOPEN_EXTRA_CFLAGS} ${instrumentOptions}"
export CXXFLAGS="${ZOPEN_CXXFLAGS} ${ZOPEN_EXTRA_CXXFLAGS} ${instrumentOptions}"
Expand Down
2 changes: 1 addition & 1 deletion docs/Guides/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG)"

---

### Quick Install (if `curl` and `bash` are available)
### Quick Install (if `curl`, `bash`, and `jq` are available)

Run the following one-liner:

Expand Down
64 changes: 43 additions & 21 deletions tools/zopen_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,82 @@ if [[ $(uname) != "OS/390" ]]; then
fi

if ! command -v curl > /dev/null 2>&1; then
echo "Error: 'curl' command not found. Please install curl."
echo "Error: 'curl' command not found. Please install curl. You can obtain curl from IBM Open Enterprise Foundation for z/OS."
exit 1
fi

ZOPEN_RELEASE_JSON="https://raw.githubusercontent.com/zopencommunity/meta/main/docs/api/zopen_releases_latest.json"
if ! command -v jq > /dev/null 2>&1; then
echo "Error: 'jq' command not found. Please install jq. You can obtain jq from IBM Open Enterprise Foundation for z/OS."
exit 1
fi

# Download the latest json
ZOPEN_RELEASE_JSON="https://raw.githubusercontent.com/zopencommunity/meta/main/docs/api/zopen_releases.json"

# ----------------------------
# DOWNLOAD RELEASE JSON
# ----------------------------
echo "> Getting latest data from zopen community..."
url=$(curl --fail-with-body --silent -L $ZOPEN_RELEASE_JSON)
json=$(curl --fail-with-body --silent -L "$ZOPEN_RELEASE_JSON")
if [ $? -gt 0 ]; then
echo "Error: Curl failed to download release json $ZOPEN_RELEASE_JSON due to: \"$url\""
echo "Error: Curl failed to download release json $ZOPEN_RELEASE_JSON due to: \"$json\""
exit 1
fi

# TODO: check if jq is present, and use it instead of this
url=$(echo "$url" | /bin/tr ' ' '\n' | grep "https://github.com/zopencommunity/metaport/releases/download/" | /bin/sed -e 's/.*\(https:\/\/github.com\/zopencommunity\/metaport\/releases\/download\/[^"]*\.pax\.Z\).*/\1/')
paxFile=$(basename "$url");
# ----------------------------
# Filter only STABLE metaport releases
url=$(echo "$json" | jq -r '
first(
.release_data.meta[]?
| select(.tag_name | startswith("STABLE_"))
| .assets[0].url
)
')

paxFile=$(basename "$url")

echo "> Downloading zopen community $url..."

# ----------------------------
# DOWNLOAD FILE
# ----------------------------
echo "> Downloading zopen community package..."
response=$(curl --fail-with-body -O -L "$url")
if [ $? -gt 0 ]; then
echo "Error: Curl failed to download latest zopen due to: \"$response\"."
echo "Error: Curl failed to download STABLE zopen meta due to: \"$response\"."
exit 1
fi

if [ ! -f $paxFile ]; then
echo "Error: $paxFile not present."
if [ ! -f "$paxFile" ]; then
echo "Error: $paxFile not present after download."
exit 1
fi

# Extract meta.pax.Z
# ----------------------------
# EXTRACT
# ----------------------------
echo "> Extracting $paxFile..."
paxOutput=$(pax -rvf "$paxFile" 2>&1)
if [ $? -gt 0 ]; then
echo "Error: Failed to unpax file $paxFile."
exit 1
exit 1
fi

echo "> Cleaning up pax file $paxFile..."
rm -vf "$paxFile"
if [ $? -gt 0 ]; then
echo "Warning: Failed to remove pax file $paxFile. Installation will continue, but space might not be freed."
echo "Warning: Failed to remove pax file $paxFile. Installation continues."
fi


dir=$(echo "$paxOutput" | head -1)
if [ ! -d "$dir" ]; then
echo "Error: $dir is not a valid directory."
exit 1
fi

# From this point on, exit immediately if a command exits with a non-zero status.
set -e
set -e

# ----------------------------
# INSTALL
# ----------------------------
echo "> Moving to extracted directory..."
cd "$dir"

Expand All @@ -76,8 +97,9 @@ zopen init

echo "> Cleaning up extracted directory..."
cd ..
rm -rvf $dir
rm -rvf "$dir"

echo "> zopen meta package installed successfully (stable release)."

echo "> zopen meta package installed successfully and cleanup complete."
exit 0

exit 0
Loading