From 153477cb3eb5081b4e230b010338b7ea4f8448e3 Mon Sep 17 00:00:00 2001 From: Igor Todorovski Date: Sun, 30 Nov 2025 00:18:37 -0500 Subject: [PATCH 1/3] feat: add -E/--editable option to zopen-build This option appends -Wl,-bedit=yes to LDFLAGS, enabling editing of the executable. --- bin/zopen-build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/zopen-build b/bin/zopen-build index 1110748ed..284fc48a7 100755 --- a/bin/zopen-build +++ b/bin/zopen-build @@ -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. @@ -387,6 +388,7 @@ processOptions() instrument=false printSourceDir=false use_ccache=false + editable=false depsDepth=2 while [ $# -gt 0 ]; do case $1 in @@ -463,6 +465,9 @@ processOptions() shift buildEnvFile=$1 ;; + "-E" | "--editable") + editable=true + ;; "-c" | "--clean") cleanupBuild=true ;; @@ -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}" From 29d610f323ac3d1fc5ae56ee1086b44ef9a2db31 Mon Sep 17 00:00:00 2001 From: Igor Todorovski Date: Mon, 1 Dec 2025 23:04:50 -0500 Subject: [PATCH 2/3] Fix zopen-install.sh to install only stable builds --- tools/zopen_install.sh | 64 ++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/tools/zopen_install.sh b/tools/zopen_install.sh index 3e27ebdbb..830bb4938 100755 --- a/tools/zopen_install.sh +++ b/tools/zopen_install.sh @@ -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" @@ -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 From d433ea2d18b28cc2c2ceb0fa9cc0b8a68078947c Mon Sep 17 00:00:00 2001 From: Igor Todorovski Date: Mon, 1 Dec 2025 23:05:34 -0500 Subject: [PATCH 3/3] Fix zopen-install.sh to install only stable builds --- docs/Guides/QuickStart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Guides/QuickStart.md b/docs/Guides/QuickStart.md index 55c66d67d..43090a89a 100644 --- a/docs/Guides/QuickStart.md +++ b/docs/Guides/QuickStart.md @@ -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: