OpenSSL icon indicating copy to clipboard operation
OpenSSL copied to clipboard

Build 1.0.2 into XCFramework

Open 666tos opened this issue 4 years ago • 4 comments

Hi @krzyzanowskim, i did ask you regarding building 1.0.2.x with XCode 12 and this is a PR. It makes sense to keep it as separate branch since it's legacy version of OpenSSL. Included platforms:

  • iOS (arm64, armv7, armv7s)
  • iOS-simulator (x86_64, i386)
  • MacOS (x86_64 only)

666tos avatar Jan 12 '21 16:01 666tos

@666tos Nice work. Is there any way to get the arm64 slice for macOS as well? I don't see any way in the Configure for OpenSSL 1.0.2.x but perhaps I'm missing something?

levigroker avatar Feb 05 '21 00:02 levigroker

@levigroker there is no ready-made configuration for it, since arm64 Macs did not exist at that time. But I believe it's doable. You can take a look at configure() function in scripts/build.sh where CFLAG and CFLAGS are set up. I believe, it should look like this.

if [ "$OS" == "MacOSX" ]; then
  if [ "$ARCH" == "x86_64" ]; then
     ${SRC_DIR}/Configure darwin64-x86_64-cc no-asm no-shared --prefix="${PREFIX}" &> "${PREFIX}.config.log"
  else if [ "$ARCH" == "arm64" ]; then
     ${SRC_DIR}/Configure iphoneos-cross no-asm no-shared --prefix="${PREFIX}" &> "${PREFIX}.config.log"
  fi
  sed -ie "s!^CFLAG=!CFLAG=-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -fembed-bitcode -arch $ARCH !" "${SRC_DIR}/Makefile"
  sed -ie "s!^CFLAGS=!CFLAGS=-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -fembed-bitcode -arch $ARCH !" "${SRC_DIR}/Makefile"
fi

And then in build_macos() function

build "x86_64" "MacOSX" ${TMP_BUILD_DIR} "macosx"
build "arm64" "MacOSX" ${TMP_BUILD_DIR} "macosx"

I have no time to perform a check right now and my current laptop is ridiculously slow, so you have to try it yourself.

666tos avatar Feb 05 '21 08:02 666tos

@666tos Many thanks! I was able to get it to work based on your suggestions and some other tweaks. Let me know if you are interested in a PR to your fork. Cheers!

levigroker avatar Feb 06 '21 01:02 levigroker

when can we get this merged in seems its a fix that will resolve this issue Screen Shot 2021-07-02 at 12 54 34 PM

elemanhillary-zz avatar Jul 02 '21 09:07 elemanhillary-zz