@@ -63,14 +63,14 @@ function init_plat_env() {
6363 if [[ " $XC_PLAT " == ' ios' ]]; then
6464 export XC_OTHER_CFLAGS=" -fembed-bitcode"
6565 ALL_ARCHS=" arm64 arm64_simulator x86_64_simulator"
66- elif [[ " $XC_PLAT " == ' macos' ]]; then
66+ elif [[ " $XC_PLAT " == ' macos' ]]; then
6767 export XC_OTHER_CFLAGS=" "
6868 ALL_ARCHS=" x86_64 arm64"
69- elif [[ " $XC_PLAT " == ' tvos' ]]; then
69+ elif [[ " $XC_PLAT " == ' tvos' ]]; then
7070 export XC_OTHER_CFLAGS=' '
7171 ALL_ARCHS=" arm64 arm64_simulator x86_64_simulator"
7272 fi
73-
73+
7474 if [[ -z " $XC_ALL_ARCHS " ]]; then
7575 export XC_ALL_ARCHS=$ALL_ARCHS
7676 else
@@ -94,12 +94,12 @@ function init_plat_env() {
9494 export XC_PRODUCT_ROOT=" ${THIS_DIR} /../build/product/${XC_PLAT} "
9595 export XC_UNI_PROD_DIR=" ${XC_PRODUCT_ROOT} /universal"
9696 export XC_UNI_SIM_PROD_DIR=" ${XC_PRODUCT_ROOT} /universal-simulator"
97-
97+
9898 export XC_IOS_PRODUCT_ROOT=" ${THIS_DIR} /../build/product/ios"
9999 export XC_MACOS_PRODUCT_ROOT=" ${THIS_DIR} /../build/product/macos"
100100 export XC_TVOS_PRODUCT_ROOT=" ${THIS_DIR} /../build/product/tvos"
101101 export XC_XCFRMK_DIR=" ${THIS_DIR} /../build/product/xcframework"
102-
102+
103103 # common xcode configuration
104104 export XC_TAGET_OS=" darwin"
105105 export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
@@ -115,14 +115,27 @@ function init_libs_pkg_config_path() {
115115 fi
116116
117117 pkg_cfg_dir=
118- for lib in $( ls " $universal_dir " ) ; do
118+
119+ for dir in ` find " ${XC_PRODUCT_ROOT} " -type f -name " *.pc" | xargs dirname | uniq` ;
120+ do
121+ if [[ " $dir " =~ " $_XC_ARCH " ]]; then
122+ if [[ $pkg_cfg_dir ]]; then
123+ pkg_cfg_dir=" ${pkg_cfg_dir} :${dir} "
124+ else
125+ pkg_cfg_dir=" ${dir} "
126+ fi
127+ fi
128+ done
129+
130+ for dir in ` find " ${universal_dir} " -type f -name " *.pc" | xargs dirname | uniq` ;
131+ do
119132 if [[ $pkg_cfg_dir ]]; then
120- pkg_cfg_dir=" ${pkg_cfg_dir} :${universal_dir} / ${lib} /lib/pkgconfig "
133+ pkg_cfg_dir=" ${pkg_cfg_dir} :${dir} "
121134 else
122- pkg_cfg_dir=" ${universal_dir} / ${lib} /lib/pkgconfig "
135+ pkg_cfg_dir=" ${dir} "
123136 fi
124137 done
125-
138+
126139 # disabling pkg-config-path
127140 # https://gstreamer-devel.narkive.com/TeNagSKN/gst-devel-disabling-pkg-config-path
128141 # export PKG_CONFIG_LIBDIR=${sysroot}/lib/pkgconfig
@@ -138,7 +151,7 @@ function init_arch_env () {
138151 fi
139152
140153 export _XC_ARCH=" $1 "
141-
154+
142155 if [[ " $XC_PLAT " == ' ios' ]]; then
143156 case $_XC_ARCH in
144157 * _simulator)
@@ -155,11 +168,11 @@ function init_arch_env () {
155168 exit 1
156169 ;;
157170 esac
158- elif [[ " $XC_PLAT " == ' macos' ]]; then
171+ elif [[ " $XC_PLAT " == ' macos' ]]; then
159172 export XCRUN_PLATFORM=' MacOSX'
160173 export MACOSX_DEPLOYMENT_TARGET=10.11
161174 export XC_DEPLOYMENT_TARGET=" -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET "
162- elif [[ " $XC_PLAT " == ' tvos' ]]; then
175+ elif [[ " $XC_PLAT " == ' tvos' ]]; then
163176 case $_XC_ARCH in
164177 * _simulator)
165178 export XCRUN_PLATFORM=' AppleTVSimulator'
@@ -188,7 +201,7 @@ function init_arch_env () {
188201 # xcrun -sdk macosx --show-sdk-path
189202 # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
190203 export XCRUN_SDK_PATH=` xcrun -sdk $XCRUN_SDK --show-sdk-path`
191-
204+
192205 # x86_64
193206 export XC_ARCH=" ${_XC_ARCH/ _simulator/ } "
194207 # ffmpeg-x86_64
0 commit comments