Skip to content

Commit c7697d9

Browse files
Merge pull request #5 from weslleymurdock/feature/release
Feature/release
2 parents 1fa5aa7 + 9c47119 commit c7697d9

File tree

6 files changed

+165
-81
lines changed

6 files changed

+165
-81
lines changed

Diff for: .github/workflows/pjsua2.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,26 @@ on:
99

1010
jobs:
1111
libpjsua2-ios:
12-
runs-on: macos-latest
12+
runs-on: macos-13
13+
name: iOS Build
1314
permissions:
1415
contents: write
15-
steps:
16-
- uses: actions/checkout@v4
16+
steps:
17+
- name: Setup Xcode
18+
uses: maxim-lobanov/[email protected]
19+
with:
20+
xcode-version: '15.1'
21+
- name: Checkout
22+
uses: actions/checkout@v4
1723
with:
1824
submodules: recursive
1925
- name: build all ios archs
2026
run: |
21-
brew install nasm autoconf automake libtool
22-
./build --ssl --opus --h264 -a=armv7,armv7s,arm64
27+
brew install nasm autoconf automake libtool swig
28+
sudo mv /Applications/Xcode_15.1.app /Applications/Xcode.app
29+
sed -i'' -e 's/xamarin/maui/g' ${{ github.workspace }}/pjproject/pjsip-apps/src/swig/csharp/Makefile
30+
./build --ssl --opus --h264 -a=x86_64,arm64
2331
- uses: actions/upload-artifact@v3
2432
with:
25-
name: lipjsua2-ios
26-
path: ${{ github.workspace }}/lib
33+
name: libpjsua2-ios
34+
path: ${{ github.workspace }}/libpjsua2

Diff for: .github/workflows/release.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
run-name: Release libpjsua2 🚀
3+
4+
on:
5+
push:
6+
tags:
7+
'*'
8+
jobs:
9+
release:
10+
runs-on: macos-13
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Setup Xcode
15+
uses: maxim-lobanov/[email protected]
16+
with:
17+
xcode-version: '15.1'
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
- name: build pjsip with opus and h264
23+
run: |
24+
brew install nasm autoconf automake libtool swig
25+
sed -i'' -e 's/xamarin/maui/g' ${{ github.workspace }}/pjproject/pjsip-apps/src/swig/csharp/Makefile
26+
./build h264 opus ssl -a=x86_64,arm64
27+
tar -zcvf libpjsua2.tar.gz ./libpjsua2
28+
- name: release
29+
uses: actions/create-release@v1
30+
id: create_release
31+
with:
32+
draft: false
33+
prerelease: false
34+
release_name: ${{ github.ref }}
35+
tag_name: ${{ github.ref }}
36+
body_path: CHANGELOG.md
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
- name: upload ios artifact
40+
uses: actions/upload-release-asset@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
asset_path: ./libpjsua2.tar.gz
46+
asset_name: libpjsua2.tar.gz
47+
asset_content_type: application/gzip

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- First Release

Diff for: README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ An android version is available [here](https://github.com/weslleymurdock/libpjsu
3838
### Remaining TODO
3939

4040
- [ ] Workflow for Xamarin app build.
41-
- [ ] Port PJSIP Xamarin app to MAUI
42-
- [ ] Release c# bindings
41+
- [ ] Port PJSIP Xamarin app to MAUI
4342

4443
### ACKNOWLEDGEMENTS
4544

Diff for: build

+53-72
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export PATH_REPO="/Users/runner/work/libpjsua2-ios/libpjsua2-ios"
1313
#export BASE_DIR=`pwd -P`
1414
export BASE_DIR="$PATH_REPO"
1515

16-
export MIN_IOS_VERSION="10.0"
17-
export IOS_SDK_VERSION="16.2"
16+
export MIN_IOS_VERSION="11.0"
17+
export IOS_SDK_VERSION="17.2"
1818
export AVAILABLE_ARCHS
1919
export USE_ARCHS=()
2020

@@ -28,7 +28,7 @@ export ENABLE_ZRTP=false
2828
export HAS_BITCODE=true
2929
export HAS_IPV6=false
3030
export SHOW_HELP=false
31-
export PJSIP_VERSION="2.13.1"
31+
export PJSIP_VERSION="2.14"
3232
export PJSIP_BASE_URL="https://github.com/pjsip/pjproject.git"
3333
export PJSIP_DIR="$BASE_DIR/pjsip"
3434
export PJSIP_FINAL_LIB_DIR="$BASE_DIR/lib"
@@ -245,7 +245,8 @@ function build_ssl () {
245245
mv include2/openssl include/openssl
246246
popd > /dev/null
247247
echo "Using SSL..."
248-
248+
rm -rf lib
249+
249250
if [ $ENABLE_ZRTP = true ]; then
250251
build_zrtp
251252
fi
@@ -393,6 +394,10 @@ function config_site () {
393394
if [ $HAS_IPV6 = true ]; then
394395
echo " #define PJ_HAS_IPV6 1" >> $PJSIP_CONFIG_SITE_H
395396
fi
397+
398+
if [ $OPUS_SUPPORT = true ]; then
399+
echo "#define PJMEDIA_HAS_OPUS_CODEC 1" >> "$PJSIP_CONFIG_SITE_H"
400+
fi
396401

397402
while IFS=',' read -ra CONFIG_SITE_OPTION; do
398403
for i in "${CONFIG_SITE_OPTION[@]}"; do
@@ -412,6 +417,7 @@ function build_archs () {
412417
configure_"$arch"
413418
_build $arch
414419
_collect $arch
420+
_merge_archs $arch
415421
done
416422

417423
echo "Done building the ABIs"
@@ -470,14 +476,25 @@ function _build () {
470476
export CFLAGS="${CFLAGS} -fembed-bitcode"
471477
fi
472478

473-
if [ $SSL_SUPPORT = true ]; then
474-
configure="$configure --with-ssl=${SSL_BUILD_DIR}"
475-
export CFLAGS="${CFLAGS} -I${SSL_BUILD_DIR}/include"
476-
export LDFLAGS="${LDFLAGS} -L${SSL_BUILD_DIR}/lib"
479+
480+
if [ $SSL_SUPPORT = true ]; then
481+
if [ "$arch" != "i386" ] && [ "$arch" != "x86_64" ]; then
482+
configure="$configure --with-ssl=${SSL_BUILD_DIR}/bin/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk"
483+
export CFLAGS="${CFLAGS} -I${SSL_BUILD_DIR}/bin/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk/include"
484+
export LDFLAGS="${LDFLAGS} -L${SSL_BUILD_DIR}/bin/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk/lib"
485+
else
486+
configure="$configure --with-ssl=${SSL_BUILD_DIR}/bin/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk"
487+
export CFLAGS="${CFLAGS} -I${SSL_BUILD_DIR}/bin/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk/include"
488+
export LDFLAGS="${LDFLAGS} -L${SSL_BUILD_DIR}/bin/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk/lib"
489+
fi
477490
fi
478491

479492
if [ $OPUS_SUPPORT = true ]; then
480-
configure="$configure --with-opus=${OPUS_BUILD_DIR}/dependencies"
493+
if [ "$arch" != "i386" ] && [ "$arch" != "x86_64" ]; then
494+
configure="$configure --with-opus=${OPUS_BUILD_DIR}/build/built/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk/"
495+
else
496+
configure="$configure --with-opus=${OPUS_BUILD_DIR}/build/built/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk/"
497+
fi
481498
fi
482499

483500
if [ $H264_SUPPORT = true ]; then
@@ -487,7 +504,6 @@ function _build () {
487504
fi
488505

489506
export LDFLAGS="${LDFLAGS} -lstdc++"
490-
#export MIN_IOS="-miphoneos-version-min=${MIN_IOS_VERSION}"
491507

492508
if [ "$arch" == "i386" ] || [ "$arch" == "x86_64" ]; then
493509
export MIN_IOS="-mios-simulator-version-min=${MIN_IOS_VERSION}"
@@ -499,11 +515,11 @@ function _build () {
499515

500516
cp $PJSIP_CONFIG_SITE_H "$PJSIP_SRC_DIR/pjlib/include/pj"
501517

502-
ARCH="-arch $arch" $configure >> $arch_log 2>&1 || exit
518+
ARCH="-arch $arch" $configure #>> $arch_log 2>&1 || exit
503519
echo "make dep"
504-
make dep
520+
make dep >> $arch_log 2>&1
505521
echo "make "
506-
make
522+
make >> $arch_log 2>&1
507523

508524
if [ $SSL_SUPPORT = true ]; then
509525
if [ $ENABLE_ZRTP = true ]; then
@@ -522,7 +538,7 @@ function _build () {
522538
cd "$PJSIP_SRC_DIR/pjsip-apps/src/swig"
523539
make clean
524540
make
525-
541+
526542
echo "Done building for $arch"
527543
echo "============================="
528544

@@ -535,75 +551,34 @@ function _collect () {
535551
cd $BASE_DIR
536552
mkdir -p "lib/$1"
537553

538-
if [ -d "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2xamarin/pjsua2xamarin.iOS/lib/" ]; then
539-
cp -v "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2xamarin/pjsua2xamarin.iOS/lib/$1/libpjsua2.a" ./lib/$1
554+
if [ -d "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui.iOS/lib/" ]; then
555+
cp -v "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui.iOS/lib/$1/libpjsua2.a" $BASE_DIR/lib/$1
540556
fi
541557

542-
if [ -d ./pjsip/external/openh264/build/$1/lib ]; then
543-
cp -v ./pjsip/external/openh264/build/$1/lib/*.a ./lib/$1
558+
if [ -d ./external/openh264/builds/$1/lib ]; then
559+
cp -v ./external/openh264/builds/$1/lib/*.a $BASE_DIR/lib/$1
544560
fi
545561

546-
if [ -d ./pjsip/external/opus/build/built/*$1.sdk/lib ]; then
547-
cp -v ./pjsip/external/opus/build/built/*$1.sdk/lib/*.a ./lib/$1
562+
if [ -d ./external/opus/build/built/*$1.sdk/lib ]; then
563+
cp -v ./external/opus/build/built/*$1.sdk/lib/*.a $BASE_DIR/lib/$1
548564
fi
549565

550-
if [ -d ./pjsip/external/openssl_ios/bin/*$1.sdk/lib ]; then
551-
cp -v ./pjsip/external/openssl_ios/bin/*$1.sdk/lib/*.a ./lib/$1
566+
if [ -d ./external/openssl_ios/bin/*$1.sdk/lib ]; then
567+
cp -v ./external/openssl_ios/bin/*$1.sdk/lib/*.a $BASE_DIR/lib/$1
552568
fi
553569

554570
# if [ $INDEPENDENT_WEBRTC = true ]; then
555-
# rm ./pjsip/temp/$1/libsrtp*.a
571+
# rm ./pjproject/third_party/lib/libsrtp*.a
556572
# fi
557573
}
558574

559-
function _copy_built_files () {
560-
echo "copy"
575+
function _merge_archs () {
576+
echo "============================="
577+
echo "======== MERGE LIBS ========="
561578
cd $BASE_DIR
562-
lipo_args=""
563-
mkdir -p "$PJSIP_FINAL_LIB_DIR"
564-
a_files=`find ./pjproject -name *.a -exec printf '%s ' {} +`
565-
566-
for arch in "${USE_ARCHS[@]}"; do
567-
568-
mkdir -p "$PJSIP_FINAL_LIB_DIR/$arch"
569-
570-
if [ -d ./pjsip/external/openh264/build/$arch/lib ]; then
571-
cp -v ./pjsip/external/openh264/build/$arch/lib/*.a ${PJSIP_FINAL_LIB_DIR}/$arch
572-
fi
573-
574-
if [ -d ./pjsip/external/opus/build/built/*$arch.sdk/lib ]; then
575-
cp -v ./pjsip/external/opus/build/built/*$arch.sdk/lib/*.a ${PJSIP_FINAL_LIB_DIR}/$arch
576-
fi
577-
578-
if [ -d ./pjsip/external/openssl_ios/bin/*$arch.sdk/lib ]; then
579-
cp -v ./pjsip/external/openssl_ios/bin/*$arch.sdk/lib/*.a ${PJSIP_FINAL_LIB_DIR}/$arch
580-
fi
581-
582-
done
583-
584-
if [ ! -d "${PJSIP_FINAL_LIB_DIR}/fat" ]; then
585-
mkdir -p "${PJSIP_FINAL_LIB_DIR}/fat"
586-
fi
587-
588-
if [ ! -d "${PJSIP_FINAL_LIB_DIR}/pjsua2xamarin" ]; then
589-
mkdir -p "${PJSIP_FINAL_LIB_DIR}/pjsua2xamarin"
590-
fi
591-
592-
if [ -d "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2xamarin" ]; then
593-
cp -v -r "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2xamarin" "${PJSIP_FINAL_LIB_DIR}/pjsua2xamarin"
594-
fi
595-
echo "--- libtool fat pjsua2"
596-
597-
598-
599-
libtool -o "$PJSIP_FINAL_LIB_DIR/fat/libpjsua2.a" $a_files
600-
601-
602-
603-
#echo "--- Lipo pjsua2"
604-
#xcrun -sdk iphoneos lipo ${lipo_args} -create -output "${PJSIP_FINAL_LIB_DIR}/fat/libpjsua2.a" || exit
605-
606-
#cp -v "$PJSIP_FINAL_LIB_DIR/libpjsua2.a" ./Pod
579+
mkdir -p "libpjsua2/lib/$1"
580+
libtool -static -o ./libpjsua2/lib/$1/libpjsua2.a $BASE_DIR/lib/$1/*
581+
echo "============================="
607582
}
608583

609584
function clean_pjsip_libs () {
@@ -734,7 +709,12 @@ function create_framework {
734709
echo "============================="
735710
}
736711

737-
712+
function copy_swig_bindings () {
713+
cd $BASE_DIR
714+
if [ -d "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui" ]; then
715+
cp -v -r "$PJSIP_SRC_DIR/pjsip-apps/src/swig/csharp/pjsua2maui/pjsua2maui" "libpjsua2/lib/"
716+
fi
717+
}
738718
start=`date +%s`
739719

740720
export -f copy_to_lib_dir
@@ -752,7 +732,8 @@ else
752732
build_ssl
753733
build_opus
754734
config_site
755-
build_archs
735+
build_archs
736+
copy_swig_bindings
756737
#create_framework
757738
fi
758739

Diff for: tag.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export VERSION="v"
5+
6+
function release_tag () {
7+
8+
if [ "$VERSION" == "v" ]; then
9+
echo "please set a version with 'v=*' parameter"
10+
exit 1
11+
fi
12+
13+
git tag $VERSION
14+
git push origin --tags
15+
}
16+
17+
function reset_tag () {
18+
echo "git tag -d ${VERSION}"
19+
git tag -d $VERSION
20+
21+
echo "git push --delete origin ${VERSION}"
22+
git push --delete origin $VERSION
23+
}
24+
25+
26+
for i in "$@"; do
27+
case $i in
28+
--version=*| v=*)
29+
VERSION_NUMBERS="${i#*=}"
30+
VERSION+="${VERSION_NUMBERS}"
31+
shift
32+
;;
33+
--reset)
34+
reset_tag
35+
shift
36+
;;
37+
--release)
38+
release_tag
39+
shift
40+
;;
41+
--help)
42+
show_help
43+
shift
44+
;;
45+
*)
46+
;;
47+
esac
48+
done

0 commit comments

Comments
 (0)