make dep: Nothing to be done for 'depend' - ios

I have been trying to compile the PJSIP library for an iOS project which needs SIP. Following this tutorial, I have been able to run the configure-iphone script. The next step would to run the make dep for the dependencies, but sadly it fails bcs of some error, unknown to me. I have also tried to edit the makefile, so it points directly to the file, but I still get the error, so it can find the file.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Samples.mak depend
make[2]: Nothing to be done for `depend'.
is the error I get.
The make file:
include ../../build.mak
include $(PJDIR)/build/common.mak
export LIBDIR := ../lib
export BINDIR := ../bin
RULES_MAK := $(PJDIR)/build/rules.mak
SAMPLES_MAK := $(PJDIR)/pjsip-apps/build/Samples.mak
###############################################################################
# Gather all flags.
#
export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
$(PJ_CFLAGS) $(CFLAGS) $(CC_INC)../../pjsip/include \
$(CC_INC)../../pjlib/include \
$(CC_INC)../../pjlib-util/include \
$(CC_INC)../../pjnath/include \
$(CC_INC)../../pjmedia/include
export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
$(HOST_CXXFLAGS) $(CXXFLAGS)
export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
$(APP_LDFLAGS) $(APP_LDLIBS) $(LDFLAGS)
###############################################################################
# Defines for building PJSUA
#
export PJSUA_SRCDIR = ../src/pjsua
export PJSUA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
main.o pjsua_app.o pjsua_app_cli.o pjsua_app_common.o \
pjsua_app_config.o pjsua_app_legacy.o
export PJSUA_CFLAGS += $(PJ_CFLAGS) $(CFLAGS)
export PJSUA_CXXFLAGS += $(PJ_CXXFLAGS) $(CFLAGS)
export PJSUA_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS)
export PJSUA_EXE:=pjsua-$(TARGET_NAME)$(HOST_EXE)
###############################################################################
# Defines for building pjsystest
#
export PJSYSTEST_SRCDIR = ../src/pjsystest
export PJSYSTEST_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
systest.o main_console.o
export PJSYSTEST_CFLAGS += $(PJ_CFLAGS) $(CFLAGS)
export PJSYSTEST_CXXFLAGS += $(PJ_CXXFLAGS) $(CFLAGS)
export PJSYSTEST_LDFLAGS += $(PJ_LDFLAGS) $(PJ_LDLIBS) $(LDFLAGS)
export PJSYSTEST_EXE:=pjsystest-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
TARGETS := $(PJSUA_EXE) $(PJSYSTEST_EXE) samples
all: $(TARGETS)
swig:
$(MAKE) -C ../src/swig
doc:
dep: depend
distclean: realclean
.PHONY: all dep depend clean realclean distclean
.PHONY: $(TARGETS)
.PHONY: $(PJSUA_EXE) $(PJSYSTEST_EXE)
pjsua: $(PJSUA_EXE)
$(PJSUA_EXE):
$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(subst /,$(HOST_PSEP),$(BINDIR)/$#)
#if echo "$(TARGET_NAME)" | grep -q "apple-darwin_ios$$"; then \
for F in $(filter %$(TARGET_NAME).a,$(PJ_LIBXX_FILES)); do \
if test -f $$F; then \
tmp=`echo $${F##*/} | sed -e "s/\-$(TARGET_NAME)\.a/.a/"`; \
ln -sf $$F ../src/pjsua/ios/$$tmp; \
fi; \
done; \
fi;
pjsystest: $(PJSYSTEST_EXE)
$(PJSYSTEST_EXE):
$(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $(subst /,$(HOST_PSEP),$(BINDIR)/$#)
samples:
$(MAKE) -f $(SAMPLES_MAK)
.PHONY: pjsua.ko
pjsua.ko:
$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(subst /,$(HOST_PSEP),$(LIBDIR)/$#)
clean depend realclean:
$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $#
$(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $#
#Problem happens in the next row!
$(MAKE) -f $(SAMPLES_MAK) $#
#if test "$#" = "depend"; then \
echo '$(BINDIR)/$(PJSUA_EXE): $(APP_LIB_FILES)' >> .pjsua-$(TARGET_NAME).depend; \
echo '$(BINDIR)/$(PJSYSTEST_EXE): $(APP_LIB_FILES)' >> .pjsystest-$(TARGET_NAME).depend; \
fi
#if echo "$(TARGET_NAME)" | grep -q "apple-darwin_ios$$"; then \
for F in $(filter %$(TARGET_NAME).a,$(PJ_LIBXX_FILES)); do \
tmp=`echo $${F##*/} | sed -e "s/\-$(TARGET_NAME)\.a/.a/"`; \
rm -f ../src/pjsua/ios/$$tmp; \
done; \
fi;
Like I said, I added the SAMPLES_MAK variable, but sadly it didn't help. I also found out which line is giving me the error, it's close to the end of the file $(MAKE) -f $(SAMPLES_MAK) $#.

Use official documentation for building. It works 100% for all current architectures for iOS.

Usually this means you've accidentally (?) created a file or directory named depend in your working directory. So, make sees that file or directory and, since the makefile doesn't list any prerequisites of the depend target, it believe the target is up to date.
This is why generally you declare these types of helper targets to be .PHONY, but apparently that makefile doesn't do this.

Related

Compiling MMIF with gfortran

I'm trying to compile MMIF (mesoscale meteorological interface) on a HPC. Although MMIF compiles it doesn't work (mmif: command not found). I'm concerned installing/adding more libraries will cause issues with WRF, which I have successfully compiled on the HPC
The makefile log file is /usr/bin/ld: warning: libgfortran.so.5, needed by /apps/spack/hbv2/linux-centos7-x86_64/gcc-9.2.0/netcdf-fortran-4.5.3-qlkoxdcdchzdgg6nemvt5r6uox77d6ut/lib/libnetcdff.so, may conflict with libgfortran.so.4
libgfortran.so.4 & libgfortran.so.5 are both located in /usr/lib/x86_64-linux-gnu/
The makefile is
INCL = -I$(NETCDF_DIR)/include -I$(HDF5)/include
LIBS = -L$(NETCDF_DIR)/lib -lnetcdff -lnetcdf
PROGRAM = mmif
TODAY = 2021-12-15
VERSION = 4.0
NEWTAG = 4.0 2021-12-15
OLDTAG = 3.4.2rc2 2020-12-15
MODULES = met_fields.f90 functions.f90 module_llxy.f90 wrf_netcdf.f90 \
parse_control.f90
SOURCES = aggregate.f90 avg_zface.f90 cloud_cover.f90 interpolate.f90 \
landuse.f90 mmif.f90 output_aercoare.f90 output_aermet.f90 \
output_calmet.f90 output_onsite.f90 output_scichem.f90 \
pasquill_gifford.f90 pbl_height.f90 read_mm5.f90 read_wrf.f90 \
sfc_layer.f90 timesubs.f90
OBJECTS = $(SOURCES:.f90=.o)
MODOBJS = $(MODULES:.f90=.o)
MODMODS = $(MODULES:.f90=.mod)
$(PROGRAM): $(MODOBJS) $(OBJECTS)
$(FC) $(FFLAGS) $(MODOBJS) $(OBJECTS) $(LIBS) -o $#
%.o : %.f90
$(FC) $(FFLAGS) $(INCL) -c $< -o $#
install: $(PROGRAM)
cp $(PROGRAM) /usr/local/bin
update_version:
sed -i "s|VERSION $(OLDTAG)|VERSION $(NEWTAG)|g" \
*.f90 README.txt makefile makefile.windows mmif_change_log.txt
distro:
mmif --sample > mmif.inp
unix2dos *.f90 *.sh makefile.windows old_compile.bat README*.txt mmif.inp
zip -j MMIFv$(VERSION)_$(TODAY).zip \
mmif.exe mmif mmif.inp *.f90 *.sh makefile \
makefile.windows old_compile.bat README*.txt \
MMIFv$(VERSION)_Users_Manual.pdf \
mmif_change_log.txt test_problems/*/*.inp
dos2unix *.f90
test_pkg:
zip -r MMIFv$(VERSION)_test_problems.zip \
test_problems -x \*/wrf/\* \*/mm5/\*
test_pkg_mm5+wrf:
zip -r MMIF_test_problems_mm5+wrf.zip \
test_problems/wrf \
test_problems/mm5 ```

How to Build OpenSSL for iOS and OSX

I have been trying to figure out how to create/build static and dynamic OpenSSL libraries for apple platform i.e iOS and osx but unable to find any proper documentation.
I need to build the 1.1.1i version of openssl or any 1.1.1 equivalent.
Tried to follow this https://github.com/keeshux/openssl-apple but then it fails while building MAC-OSX arm64.
Can anybody please point me right/working direction??
Thanks!!
This script may help. It builds the OpenSSL 1.1.1 and 1.0.2 series libraries (reference - also has build script for OSX)
iOS Build
#!/bin/bash
#
# This script downloads and builds the iOS openSSL libraries with Bitcode enabled
#
# Author: Jason Cox, #jasonacox https://github.com/jasonacox/Build-OpenSSL-cURL
# Date: 2020-Aug-15
#
set -e
# Custom build options
CUSTOMCONFIG="enable-ssl-trace"
# Formatting
default="\033[39m"
white="\033[97m"
green="\033[32m"
red="\033[91m"
yellow="\033[33m"
bold="\033[0m${green}\033[1m"
subbold="\033[0m${green}"
archbold="\033[0m${yellow}\033[1m"
normal="${white}\033[0m"
dim="\033[0m${white}\033[2m"
alert="\033[0m${red}\033[1m"
alertdim="\033[0m${red}\033[2m"
# set trap to help debug build errors
trap 'echo -e "${alert}** ERROR with Build - Check /tmp/openssl*.log${alertdim}"; tail -3 /tmp/openssl*.log' INT TERM EXIT
# Set minimum OS versions for target
MACOS_X86_64_VERSION="" # Empty = use host version
MACOS_ARM64_VERSION="" # Min supported is MacOS 11.0 Big Sur
CATALYST_IOS="13.0" # Min supported is iOS 13.0 for Mac Catalyst
IOS_MIN_SDK_VERSION="8.0"
IOS_SDK_VERSION=""
TVOS_MIN_SDK_VERSION="9.0"
TVOS_SDK_VERSION=""
catalyst="0"
VERSION="1.1.1i" # OpenSSL version default
CORES=$(sysctl -n hw.ncpu)
OPENSSL_VERSION="openssl-${VERSION}"
if [ -z "${MACOS_X86_64_VERSION}" ]; then
MACOS_X86_64_VERSION=$(sw_vers -productVersion)
fi
if [ -z "${MACOS_ARM64_VERSION}" ]; then
MACOS_ARM64_VERSION=$(sw_vers -productVersion)
fi
usage ()
{
echo
echo -e "${bold}Usage:${normal}"
echo
echo -e " ${subbold}$0${normal} [-v ${dim}<version>${normal}] [-s ${dim}<version>${normal}] [-t ${dim}<version>${normal}] [-i ${dim}<version>${normal}] [-a ${dim}<version>${normal}] [-u ${dim}<version>${normal}] [-e] [-m] [-3] [-x] [-h]"
echo
echo " -v version of OpenSSL (default $VERSION)"
echo " -s iOS min target version (default $IOS_MIN_SDK_VERSION)"
echo " -t tvOS min target version (default $TVOS_MIN_SDK_VERSION)"
echo " -i macOS 86_64 min target version (default $MACOS_X86_64_VERSION)"
echo " -a macOS arm64 min target version (default $MACOS_ARM64_VERSION)"
echo " -e compile with engine support"
echo " -m compile Mac Catalyst library"
echo " -u Mac Catalyst iOS min target version (default $CATALYST_IOS)"
echo " -3 compile with SSLv3 support"
echo " -x disable color output"
echo " -h show usage"
echo
trap - INT TERM EXIT
exit 127
}
engine=0
while getopts "v:s:t:i:a:u:emx3h\?" o; do
case "${o}" in
v)
OPENSSL_VERSION="openssl-${OPTARG}"
;;
s)
IOS_MIN_SDK_VERSION="${OPTARG}"
;;
t)
TVOS_MIN_SDK_VERSION="${OPTARG}"
;;
i)
MACOS_X86_64_VERSION="${OPTARG}"
;;
a)
MACOS_ARM64_VERSION="${OPTARG}"
;;
e)
engine=1
;;
m)
catalyst="1"
;;
u)
catalyst="1"
CATALYST_IOS="${OPTARG}"
;;
x)
bold=""
subbold=""
normal=""
dim=""
alert=""
alertdim=""
archbold=""
;;
3)
CUSTOMCONFIG="enable-ssl3 enable-ssl3-method enable-ssl-trace"
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
DEVELOPER=`xcode-select -print-path`
# Semantic Version Comparison
version_lte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
if version_lte $MACOS_ARM64_VERSION 11.0; then
MACOS_ARM64_VERSION="11.0" # Min support for Apple Silicon is 11.0
fi
buildIOS()
{
ARCH=$1
pushd . > /dev/null
cd "${OPENSSL_VERSION}"
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
PLATFORM="iPhoneSimulator"
else
PLATFORM="iPhoneOS"
#sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
fi
export $PLATFORM
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${IOS_SDK_VERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -fembed-bitcode -arch ${ARCH}"
echo -e "${subbold}Building ${OPENSSL_VERSION} for ${PLATFORM} ${IOS_SDK_VERSION} ${archbold}${ARCH}${dim} (iOS ${IOS_MIN_SDK_VERSION})"
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
TARGET="darwin-i386-cc"
if [[ $ARCH == "x86_64" ]]; then
TARGET="darwin64-x86_64-cc"
fi
if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
./Configure no-asm ${TARGET} -no-shared --prefix="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
else
./Configure no-asm ${TARGET} -no-shared --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
fi
else
if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
# export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}"
./Configure iphoneos-cross DSO_LDFLAGS=-fembed-bitcode --prefix="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" -no-shared --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
else
./Configure iphoneos-cross -no-shared --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
fi
fi
# add -isysroot to CC=
if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
sed -ie "s!^CFLAGS=!CFLAGS=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${IOS_MIN_SDK_VERSION} !" "Makefile"
else
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${IOS_MIN_SDK_VERSION} !" "Makefile"
fi
make -j${CORES} >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
make install_sw >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
make clean >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
popd > /dev/null
# Clean up exports
export PLATFORM=""
export CC=""
export CXX=""
export CFLAGS=""
export LDFLAGS=""
export CPPFLAGS=""
export CROSS_TOP=""
export CROSS_SDK=""
export BUILD_TOOLS=""
}
buildIOSsim()
{
ARCH=$1
pushd . > /dev/null
cd "${OPENSSL_VERSION}"
PLATFORM="iPhoneSimulator"
export $PLATFORM
TARGET="darwin-i386-cc"
RUNTARGET=""
MIPHONEOS="${IOS_MIN_SDK_VERSION}"
if [[ $ARCH != "i386" ]]; then
TARGET="darwin64-${ARCH}-cc"
RUNTARGET="-target ${ARCH}-apple-ios${IOS_MIN_SDK_VERSION}-simulator"
# e.g. -target arm64-apple-ios11.0-simulator
#if [[ $ARCH == "arm64" ]]; then
# if (( $(echo "${MIPHONEOS} < 11.0" |bc -l) )); then
# MIPHONEOS="11.0" # Min support for Apple Silicon is iOS 11.0
# fi
#fi
fi
# set up exports for build
export CFLAGS=" -Os -miphoneos-version-min=${MIPHONEOS} -fembed-bitcode -arch ${ARCH} ${RUNTARGET} "
export LDFLAGS=" -arch ${ARCH} -isysroot ${DEVELOPER}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk "
export CPPFLAGS=" -I.. -isysroot ${DEVELOPER}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk "
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${IOS_SDK_VERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc"
export CXX="${BUILD_TOOLS}/usr/bin/gcc"
echo -e "${subbold}Building ${OPENSSL_VERSION} for ${PLATFORM} ${iOS_SDK_VERSION} ${archbold}${ARCH}${dim} (iOS ${MIPHONEOS})"
# configure
if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
./Configure no-asm ${TARGET} -no-shared --prefix="/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}" --openssldir="/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}.log"
else
./Configure no-asm ${TARGET} -no-shared --openssldir="/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}" $CUSTOMCONFIG &> "/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}.log"
fi
# add -isysroot to CC=
# no longer needed with exports
#if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
# sed -ie "s!^CFLAGS=!CFLAGS=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${IOS_MIN_SDK_VERSION} !" "Makefile"
#else
# sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${IOS_MIN_SDK_VERSION} !" "Makefile"
#fi
# make
make -j${CORES} >> "/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}.log" 2>&1
make install_sw >> "/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}.log" 2>&1
make clean >> "/tmp/${OPENSSL_VERSION}-iOS-Simulator-${ARCH}.log" 2>&1
popd > /dev/null
# Clean up exports
export PLATFORM=""
export CC=""
export CXX=""
export CFLAGS=""
export LDFLAGS=""
export CPPFLAGS=""
export CROSS_TOP=""
export CROSS_SDK=""
export BUILD_TOOLS=""
}
#echo -e "${bold}Cleaning up${dim}"
#rm -rf include/openssl/* lib/*
mkdir -p Mac/lib
mkdir -p Catalyst/lib
mkdir -p iOS/lib
mkdir -p iOS-simulator/lib
mkdir -p iOS-fat/lib
mkdir -p tvOS/lib
mkdir -p Mac/include/openssl/
mkdir -p Catalyst/include/openssl/
mkdir -p iOS/include/openssl/
mkdir -p iOS-simulator/include/openssl/
mkdir -p iOS-fat/include/openssl/
mkdir -p tvOS/include/openssl/
rm -rf "/tmp/${OPENSSL_VERSION}-*"
rm -rf "/tmp/${OPENSSL_VERSION}-*.log"
rm -rf "${OPENSSL_VERSION}"
if [ ! -e ${OPENSSL_VERSION}.tar.gz ]; then
echo "Downloading ${OPENSSL_VERSION}.tar.gz"
curl -LOs https://www.openssl.org/source/${OPENSSL_VERSION}.tar.gz
else
echo "Using ${OPENSSL_VERSION}.tar.gz"
fi
if [[ "$OPENSSL_VERSION" = "openssl-1.1.1"* ]]; then
echo "** Building OpenSSL 1.1.1 **"
else
if [[ "$OPENSSL_VERSION" = "openssl-1.0."* ]]; then
echo "** Building OpenSSL 1.0.x ** "
echo -e "${alert}** WARNING: End of Life Version - Upgrade to 1.1.1 **${dim}"
else
echo -e "${alert}** WARNING: This build script has not been tested with $OPENSSL_VERSION **${dim}"
fi
fi
echo "Unpacking openssl"
tar xfz "${OPENSSL_VERSION}.tar.gz"
if [ "$engine" == "1" ]; then
echo "+ Activate Static Engine"
sed -ie 's/\"engine/\"dynamic-engine/' ${OPENSSL_VERSION}/Configurations/15-ios.conf
fi
echo -e "${bold}Building iOS libraries${dim}"
buildIOS "armv7"
buildIOS "armv7s"
buildIOS "arm64"
buildIOS "arm64e"
buildIOSsim "i386"
buildIOSsim "x86_64"
buildIOSsim "arm64"
echo " Copying headers and libraries"
cp /tmp/${OPENSSL_VERSION}-iOS-arm64/include/openssl/* iOS/include/openssl/
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-armv7/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-armv7s/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64e/lib/libcrypto.a" \
-create -output iOS/lib/libcrypto.a
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-armv7/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-armv7s/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64e/lib/libssl.a" \
-create -output iOS/lib/libssl.a
cp /tmp/${OPENSSL_VERSION}-iOS-Simulator-x86_64/include/openssl/* iOS-simulator/include/openssl/
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-i386/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-x86_64/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-arm64/lib/libcrypto.a" \
-create -output iOS-simulator/lib/libcrypto.a
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-i386/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-x86_64/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-arm64/lib/libssl.a" \
-create -output iOS-simulator/lib/libssl.a
cp /tmp/${OPENSSL_VERSION}-iOS-arm64/include/openssl/* iOS-fat/include/openssl/
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-armv7/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-armv7s/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64e/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-i386/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-x86_64/lib/libcrypto.a" \
-create -output iOS-fat/lib/libcrypto.a
lipo \
"/tmp/${OPENSSL_VERSION}-iOS-armv7/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-armv7s/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-arm64e/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-x86_64/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-iOS-Simulator-i386/lib/libssl.a" \
-create -output iOS-fat/lib/libssl.a
echo " Creating combined OpenSSL libraries for iOS"
libtool -no_warning_for_no_symbols -static -o openssl-ios-armv7_armv7s_arm64_arm64e.a iOS/lib/libcrypto.a iOS/lib/libssl.a
libtool -no_warning_for_no_symbols -static -o openssl-ios-i386_x86_64_arm64-simulator.a iOS-simulator/lib/libcrypto.a iOS-simulator/lib/libssl.a
echo -e "${bold}Cleaning up${dim}"
rm -rf /tmp/${OPENSSL_VERSION}-*
rm -rf ${OPENSSL_VERSION}
#reset trap
trap - INT TERM EXIT
echo -e "${normal}Done"
Note:
The overarching project builds OpenSSL, nghttp2 and cURL/libcurl for MacOS (x86_64, arm64), Mac Catalyst (x86_64, arm64), iOS (armv7, armv7s, arm64 and arm64e), iOS Simulator (x86_64, arm64), tvOS (arm64) and tvOS Simulator (x86_64). Update now builds XCFrameworks which supports all platforms and targets for easy import into your projects.
Use LibreSSL instead
Granted, this is not a 1.1 version of OpenSSL, but if you're not familiar with LibreSSL it is a drop-in replacement for OpenSSL 1.0.x and I think is easier to work with from a compilation standpoint, because it relies on CMake.
Building for macOS would not necessarily require a toolchain file.
You need to do three things
Modify the CMakeLists.txt to generate a framework (if desired)
Provide a toolchain file for each SDK
Combine the output into an XCFramework - optional
I have applied the following snippet to the source root CMakeLists.txt as a Pull Request.
if (BUILD_APPLE_FRAMEWORK)
# Trick cmake into doing work - like copying the headers
set(EMPTY_C ${CMAKE_CURRENT_BINARY_DIR}/empty.c)
file(TOUCH ${EMPTY_C})
set(MODULE_MODULEMAP ${CMAKE_CURRENT_BINARY_DIR}/module.modulemap)
file(WRITE ${MODULE_MODULEMAP} "\
framework module LibreSSL {
umbrella header \"LibreSSL.h\"
export *
module * { export * }
}
")
set_source_files_properties(${MODULE_MODULEMAP} PROPERTIES
MACOSX_PACKAGE_LOCATION Modules)
# Create the umbrella header
set(LIBRESSL_H ${CMAKE_CURRENT_BINARY_DIR}/LibreSSL.h)
file(REMOVE ${LIBRESSL_H})
file(GLOB LIBRESSL_INCLUDES
${CMAKE_CURRENT_LIST_DIR}/include/*.h ${CMAKE_CURRENT_LIST_DIR}/include/openssl/*.h)
foreach(LIBRESSL_INCLUDE ${LIBRESSL_INCLUDES})
file(RELATIVE_PATH RELATIVE_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/include ${LIBRESSL_INCLUDE})
get_filename_component(RELATIVE_INCLUDE_DIR ${RELATIVE_INCLUDE} DIRECTORY)
set_source_files_properties(${LIBRESSL_INCLUDE} PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/${RELATIVE_INCLUDE_DIR})
file(APPEND ${LIBRESSL_H} "#include \"${RELATIVE_INCLUDE}\"\n")
endforeach()
# Create the framework from object libraries
add_library(LibreSSL_framework ${EMPTY_C}
$<TARGET_OBJECTS:crypto_obj> $<TARGET_OBJECTS:ssl_obj>
${LIBRESSL_H} ${LIBRESSL_INCLUDES}
${MODULE_MODULEMAP})
set_target_properties(LibreSSL_framework PROPERTIES
OUTPUT_NAME LibreSSL
PUBLIC_HEADER "${LIBRESSL_H}"
FRAMEWORK on)
install(TARGETS LibreSSL_framework
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(BUILD_APPLE_FRAMEWORK)
generate_xcframework.sh
#!/usr/bin/env bash
set -e
FRAMEWORKS=()
for SDK in macosx iphoneos iphonesimulator; do
BUILD_DIR=build-${SDK}
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
pushd ${BUILD_DIR}
cmake -G Ninja -D CMAKE_TOOLCHAIN_FILE=cmake/${SDK}.toolchain.cmake ..
cmake --build . --target LibreSSL_framework
FRAMEWORKS+=(-framework ${BUILD_DIR}/LibreSSL.framework)
popd
done
XCFRAMEWORK_DIR=build-xcframework
rm -rf ${XCFRAMEWORK_DIR}
mkdir -p ${XCFRAMEWORK_DIR}
xcodebuild -create-xcframework \
"${FRAMEWORKS[#]}" \
-output ${XCFRAMEWORK_DIR}/LibreSSL.xcframework
macosx.toolchain.cmake
set( CMAKE_SYSTEM_NAME Darwin )
set( SDK macosx CACHE STRING "Xcode SDK" )
set( CMAKE_OSX_ARCHITECTURES x86_64 arm64 CACHE STRING "Architectures" )
iphoneos.toolchain.cmake
set( CMAKE_SYSTEM_NAME Darwin )
set( SDK iphoneos CACHE STRING "Xcode SDK" )
set( CMAKE_OSX_ARCHITECTURES armv7 armv7s arm64 CACHE STRING "Architectures" )
include(${CMAKE_CURRENT_LIST_DIR}/apple-common-toolchain.cmake)
iphonesimulator.toolchain.cmake
set( CMAKE_SYSTEM_NAME Darwin )
set( SDK iphonesimulator CACHE STRING "Xcode SDK" )
set( CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING "Architectures" )
include(${CMAKE_CURRENT_LIST_DIR}/apple-common-toolchain.cmake)
apple-common-toolchain.cmake
set(BUILD_APPLE_FRAMEWORK on)
if(SDK STREQUAL iphoneos OR SDK STREQUAL iphonesimulator)
set(IOS_DEPLOYMENT_TARGET "9.0")
set(CMAKE_OSX_DEPLOYMENT_TARGET ${IOS_DEPLOYMENT_TARGET} CACHE STRING "" FORCE)
elseif(SDK STREQUAL macosx)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "Unknown sdk when setting deployment target: ${SDK}")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
execute_process(COMMAND xcrun --sdk ${SDK} --find clang
OUTPUT_VARIABLE CMAKE_C_COMPILER
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "clang executable")
execute_process( COMMAND xcrun --sdk ${SDK} --find clang++
OUTPUT_VARIABLE CMAKE_CXX_COMPILER
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "clang++ executable")
execute_process( COMMAND xcrun --sdk ${SDK} --find libtool
OUTPUT_VARIABLE CMAKE_LIBTOOL
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_LIBTOOL ${CMAKE_LIBTOOL} CACHE PATH "libtool executable")
execute_process( COMMAND xcrun --sdk ${SDK} --find strip
OUTPUT_VARIABLE CMAKE_STRIP
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_STRIP ${CMAKE_STRIP} CACHE PATH "strip executable")
execute_process( COMMAND xcrun --sdk ${SDK} --find dsymutil
OUTPUT_VARIABLE DSYMUTIL
OUTPUT_STRIP_TRAILING_WHITESPACE)
if( BUILD_TARGET_IOS AND NOT BUILD_TARGET_SIMULATOR)
if( XCODE_VERSION VERSION_LESS 11)
set(DSYMUTIL ${DSYMUTIL} -t 1)
endif()
endif()
set(DSYMUTIL ${DSYMUTIL} CACHE PATH "dsymutil executable")
execute_process( COMMAND xcrun --sdk ${SDK} --show-sdk-path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT} CACHE PATH "sysroot")
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_Swift_COMPILER_WORKS TRUE)
set(CMAKE_FIND_FRAMEWORK FIRST)
set(CMAKE_SYSTEM_FRAMEWORK_PATH ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Minix 3.2.1 Makefile issue

I'm trying to run make with the below Makefile and I get the following error Makefile:2: *** missing separator. Stop.. This Makefile is the original file from Minix 3.2.1. I haven't done any changes. I check from the tabs problem. Can someone help me?
Thanks.
# Makefile for the kernel image.
.include <bsd.own.mk>
.include "nbsd.config"
.include <bsd.own.mk>
.include <bsd.sys.mk>
u=/usr
MDEC= /usr/mdec
GEN_FILES= *.bak image kernel *.iso *.iso.gz cdfdimage rootimage src
# LSC detect where were built the objects files
PROGROOT:= ..
.if "${MAKEOBJDIR:S,${.CURDIR},,}" != ""
PROGROOT:= ${MAKEOBJDIR:S,releasetools,,}
.endif
# Specify the programs that are part of the system image.
KERNEL= ${PROGROOT}/kernel/kernel
# PROGRAMS are in the order they should be loaded by boot
PROGRAMS+= ${PROGROOT}/servers/ds/ds
PROGRAMS+= ${PROGROOT}/servers/rs/rs
PROGRAMS+= ${PROGROOT}/servers/pm/pm
PROGRAMS+= ${PROGROOT}/servers/sched/sched
PROGRAMS+= ${PROGROOT}/servers/vfs/vfs
PROGRAMS+= ${PROGROOT}/drivers/memory/memory
.if ${MACHINE_ARCH} == "i386"
PROGRAMS+= ${PROGROOT}/drivers/log/log
.endif
PROGRAMS+= ${PROGROOT}/drivers/tty/tty
PROGRAMS+= ${PROGROOT}/servers/mfs/mfs
PROGRAMS+= ${PROGROOT}/servers/vm/vm
PROGRAMS+= ${PROGROOT}/servers/pfs/pfs
PROGRAMS+= ${PROGROOT}/servers/init/init
usage:
#echo " " >&2
#echo "Master Makefile to create new MINIX configuration." >& 2
#echo "Root privileges are required." >&2
#echo " " >&2
#echo "Usage:" >&2
#echo " make includes # Install include files" >&2
#echo " make depend # Generate dependency files" >&2
#echo " make services # Compile and install all services" >&2
#echo " make install # Make image, and install to hard disk" >&2
#echo " make hdboot # Make image, and install to hard disk" >&2
#echo " make bootable # Make hard disk bootable" >&2
#echo " make nbsd_fetch # Download current NetBSD reference sources" >&2
#echo " make nbsd_diff # Update minix-port.patch in NetBSD sources" >&2
#echo " make clean # Remove all compiler results, except libs" >&2
#echo " " >&2
#echo "To create a fresh MINIX configuration, try:" >&2
#echo " make clean install # new boot image" >&2
#echo " make fresh install # new everything" >&2
#echo " " >&2
all: services
# rebuild the program or system libraries
includes:
$(MAKE) -C ../ includes
depend: includes .gitignore
$(MAKE) -C ../ depend
.gitignore: Makefile
echo $(GEN_FILES) | tr ' ' '\n' >.gitignore
services: includes kernel servers .WAIT drivers
kernel: includes
$(MAKE) -C ../kernel
servers: includes
$(MAKE) -C ../servers all install
drivers: includes servers
$(MAKE) -C ../drivers all install
# make bootable and place system images
bootable:
exec su root mkboot bootable ${DESTDIR}
hdboot: services .WAIT do-hdboot
do-hdboot:
#rm -rf ${DESTDIR}/boot/minix/.temp/
${INSTALL_DIR} ${DESTDIR}/boot/minix/.temp
# mod_0 is used to make alphabetical order equal to the boot order
#n=0; \
for i in ${PROGRAMS}; \
do \
n=`expr $$n + 1`; \
[ "$$n" -ge 10 ] && prefix="mod" || prefix="mod0"; \
newname="${DESTDIR}/boot/minix/.temp/$${prefix}$${n}_`basename $$i`"; \
${INSTALL} $$i $$newname; \
done
#cp ${PROGROOT}/kernel/kernel ${DESTDIR}/boot/minix/.temp/
#if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then \
${STRIP} -s ${DESTDIR}/boot/minix/.temp/* ; \
gzip ${DESTDIR}/boot/minix/.temp/mod* ; \
${HOST_SH} mkboot hdboot ${DESTDIR}; \
${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\
else \
${INSTALL_DIR} ${DESTDIR}/multiboot; \
${INSTALL} ${DESTDIR}/boot/minix/.temp/* ${DESTDIR}/multiboot; \
fi
install:
${MAKE} includes services hdboot
# download and update NetBSD reference sources.
nbsd_fetch:
export CVS_RSH=ssh; \
export OLDPWD=`pwd`; \
echo "retrieving hierarchies from ${NBSD_CVSROOT}"; \
IFS=,; \
cd ..; \
cat releasetools/nbsd_ports | grep -v '^#' | while read port ; \
do set $$port; \
date=$$1; minixpath=$$2; origpath=$$3; \
if [ $$# -lt 3 ]; then origpath=$$2; fi; \
echo "retrieving $$origpath .."; \
cvs -q -d ${NBSD_CVSROOT} co -N -D "$$date UTC" -d nbsdsrc "src/$$origpath" ; \
done; \
cd $${OLDPWD};
nbsd_diff:
find .. -name minix-port.patch | xargs rm
cat nbsd_ports | grep -v '^#' | \
( cd .. && awk -F, '{ minixpath=$$2; origpath=$$3; if(NF < 3) { origpath=$$2; } system("sh releasetools/nbsd_diff.sh " \
"nbsdsrc/src/"origpath" "minixpath" "minixpath"/minix-port.patch");}' )
find .. -name minix-port.patch | xargs wc -l | sort -n
# clean up compile results
clean:
$(MAKE) -C ../kernel $#
$(MAKE) -C ../servers $#
$(MAKE) -C ../drivers $#
rm -rf $(GEN_FILES)
cleandepend::
$(MAKE) -C ../kernel $#
$(MAKE) -C ../servers $#
$(MAKE) -C ../drivers $#
MINIX uses BSD make, which typically uses . to prefix its specific extensions. You installed GNU make, which has another set of extensions, not prefixed with .; furthermore you put GNU make ahead in the PATH order without renaming it. This is not going to take off.
What we usually do is to name GNU make under the name gmake or gnumake, and invoke it under that name when needed (for example, to compile packages from GNU ecosystem, or with a strong Linux bias.)
Another possibility you might consider is to install (if not already done) the bmake package, and uses that command when trying to compile programs which expect the BSD breed of make (this includes MINIX itself.)

Makefile foreach inside if

I'm trying to run a foreach function that only should run when a condition is fulfilled.
The foreach function works fine when I delete the surrounding if. When I write my makefile like the followring, the foreach loop stops working before the first command is executed and the build process never ends (I don't think that I built an infinite loop, because none of the commands inside is executed).
if [ $(BUILD_SPEC) = mySpec ]; \
then ( \
if [ ! -d $(PRJ_ROOT_DIR)/TARGET ]; then mkdir $(PRJ_ROOT_DIR)/TARGET; fi; \
$(foreach target,$(basename $(PROJECT_TARGETS)), \
if [ -e $(PRJ_ROOT_DIR)/$(BUILD_SPEC)/$(target).crc ]; \
then ( \
echo Deleting $(PRJ_ROOT_DIR)/$(BUILD_SPEC)/$(target).crc; \
rm -f $(PRJ_ROOT_DIR)/$(BUILD_SPEC)/$(target).crc; \
) \
fi; \
) \
) \
fi;
I solved this by my own:
For some reason the command "if [ $(BUILD_SPEC) = mySpec ];" does not work. I replaced it by "ifeq ($(BUILD_SPEC),mySpec)". Now the Script works the way I wanted it to.

Appledoc can't run in Xcode

So I'm following this tutorial for the appledoc generation (http://objcsharp.wordpress.com/2013/09/24/how-to-generate-beautiful-apple-style-documentation-in-xcode-5/). Nothing happens after the build. Here's the script:
#if [ ${CONFIGURATION} == "Release" ]; then
APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
$APPLEDOC_PATH \
--project-name ${PRODUCT_NAME} \
--project-company "Your Name" \
--company-id "com.yourcompany" \
--output ${PRODUCT_NAME}Docs \
--keep-undocumented-objects \
--keep-undocumented-members \
--keep-intermediate-files \
--no-repeat-first-par \
--no-warn-invalid-crossref \
--exit-threshold 2 \
${PROJECT_DIR}/${PRODUCT_NAME}
fi;
#fi;
To make sure I install the appledoc correctly, I did the following from the terminal and the doc shows up fine.
appledoc --project-name BabelCPP --project-company "My Name" --company-id com.mycompany --no-create-docset --output ./doc/ ./CaterpillarCount/CaterpillarCount
Am I missing any critical step or setup in Xcode? It seems like the following part didn't execute correctly and it's what terminate this run script:
APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
$APPLEDOC_PATH \
The default path on OSX is /usr/bin:/bin:/usr/sbin:/sbin, and if you followed the instructions, you would have copied it to /usr/local/bin.
XCode won't consider changes that you've put into your .bash_profile files, etc, so anything that's launched from it will not have a path (this includes the run script you've posted).
You can add PATH=$PATH:/usr/local/bin on the line prior to the APPLEDOC_PATH=... line, which should allow it to be found.
Secondly, you need to have a proper test:
if [ -n "$APPLEDOC_PATH" -a -x "$APPLEDOC_PATH" ]; then
i.e. test that the variable is set, and that the file is executable that it determines.
so, altogether:
PATH=$PATH:/usr/local/bin
APPLEDOC_PATH=`which appledoc`
if [ -n "$APPLEDOC_PATH" -a -x "$APPLEDOC_PATH" ]; then

Resources