krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
920 stars 340 forks source link

Build 1.0.2 into XCFramework #111

Closed 666tos closed 4 months ago

666tos commented 3 years ago

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:

levigroker commented 3 years ago

@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?

666tos commented 3 years ago

@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.

levigroker commented 3 years ago

@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!

elemanhillary-zz commented 3 years ago

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
krzyzanowskim commented 4 months ago

Closing as "wont fix". I don't plan to support 1.0.x anymore. Feel free to maintain forks for your purpose. See https://github.com/krzyzanowskim/OpenSSL/issues/110