diff --git a/.gitignore b/.gitignore index cb0e3bd2..fb54df09 100644 --- a/.gitignore +++ b/.gitignore @@ -223,4 +223,9 @@ sear_schema.hpp # Python wheels -*.whl \ No newline at end of file +*.whl + +# Shell stuff + +*.ps1 +*.sh \ No newline at end of file diff --git a/setup.py b/setup.py index 8d7ad8c9..7261fd43 100644 --- a/setup.py +++ b/setup.py @@ -80,16 +80,28 @@ def run(self): def main(): """Python extension build entrypoint.""" cwd = Path.cwd() + # Use ZOPEN_ROOTFS to find OpenSSL and ZOSLIB. - if "ZOPEN_ROOTFS" not in os.environ: + if "ZOPEN_ROOTFS" not in os.environ and not ("ZOSLIB_ROOT" in os.environ and "OPENSSL_ROOT" in os.environ): # noqa: E501 raise RuntimeError( "ZOPEN_ROOTFS is not set, but is required in order to " + "find the zopen community distributions of of OpenSSL " + "and ZOSLIB since they are build dependencies.\n" + "You can find more information about setting up zopen " + "community here: " - + "https://zopen.community/#/Guides/QuickStart?id=installing-zopen-package-manager", + + "https://zopen.community/#/Guides/QuickStart?id=installing-zopen-package-manager \n" # noqa: E501 + + "Alternatively set ZOSLIB_ROOT and OPENSSL_ROOT", ) + + if "ZOPEN_ROOTFS" not in os.environ: + openssl_lib_path = os.environ["OPENSSL_ROOT"] + "/lib/" + openssl_include_path = os.environ["OPENSSL_ROOT"] + "/include/" + zoslib_lib_path = os.environ["ZOSLIB_ROOT"] + "/lib/" + else: + openssl_lib_path = os.environ["ZOPEN_ROOTFS"] + "/usr/local/lib/" + openssl_include_path = os.environ["ZOPEN_ROOTFS"] + "/usr/local/include/" + zoslib_lib_path = os.environ["ZOSLIB_ROOT"] + "/usr/local/lib/" + assembled_object_path = cwd / "artifacts" / "irrseq00.o" generate_json_schema_header() setup_args = { @@ -109,15 +121,15 @@ def main(): "externals/json", "externals/json-schema-validator", "externals/iconv", - os.environ["ZOPEN_ROOTFS"] + "/usr/local/include", + openssl_include_path, ] ), extra_link_args=[ "-m64", "-Wl,-b,edit=no", - "-Wl," + os.environ["ZOPEN_ROOTFS"] + "/usr/local/lib/libcrypto.a", - "-Wl," + os.environ["ZOPEN_ROOTFS"] + "/usr/local/lib/libssl.a", - "-Wl," + os.environ["ZOPEN_ROOTFS"] + "/usr/local/lib/libzoslib.a", + "-Wl," + openssl_lib_path + "libcrypto.a", + "-Wl," + openssl_lib_path + "libssl.a", + "-Wl," + zoslib_lib_path + "libzoslib.a", ], extra_objects=[f"{assembled_object_path}"], ),