Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.
/ rdk-aamp Public archive

Commit e6c9e0b

Browse files
jasradakshPaulpandian Mariappan
authored and
Paulpandian Mariappan
committed
DELIA-54041 [AAMP][OSX] installer issues
Reason for change: Fix [OSX] installer issues and optimize the bash script Test procedure: Verify on developer PC Risks: Monterey specific Change-Id: Ib18b084bbe3137938abca8b6c3b10dd002d6763a (cherry picked from commit 469cee5)
1 parent 9ae6b24 commit e6c9e0b

10 files changed

+309
-267
lines changed
File renamed without changes.
File renamed without changes.

OSX/install-aamp.sh

+308
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
#!/bin/bash
2+
# This script will setup basic environment and fetch aamp code
3+
# for a vanilla Big Sur/Monterey system to be ready for development
4+
#######################Default Values##################
5+
defaultbuilddir=aamp-devenv-$(date +"%Y-%m-%d-%H-%M")
6+
defaultcodebranch="dev_sprint_22_1"
7+
defaultchannellistfile="$HOME/aampcli.csv"
8+
########################################################
9+
# Declare a status array to collect full summery to be printed by the end of execution
10+
declare -a arr_install_status
11+
12+
find_or_install_pkgs() {
13+
# Check if brew package $1 is installed
14+
# http://stackoverflow.com/a/20802425/1573477
15+
for pkg in "$@";
16+
do
17+
if brew ls --versions $pkg > /dev/null; then
18+
echo "${pkg} is already installed."
19+
arr_install_status+=("${pkg} is already installed.")
20+
else
21+
echo "Installing ${pkg}"
22+
brew install $pkg
23+
#update summery
24+
if brew ls --versions $pkg > /dev/null; then
25+
#The package is successfully installed
26+
arr_install_status+=("The package was ${pkg} was successfully installed.")
27+
28+
else
29+
#The package is failed to be installed
30+
arr_install_status+=("The package ${pkg} was FAILED to be installed.")
31+
fi
32+
fi
33+
#if pkg is openssl and its successfully installed every time ensure to symlink to the latest version
34+
if [ $pkg = "openssl" ]; then
35+
OPENSSL_PATH=$(brew info openssl|sed '4q;d'|cut -d " " -f1)
36+
sudo rm -f /usr/local/ssl
37+
sudo ln -s $OPENSSL_PATH /usr/local/ssl
38+
export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig"
39+
fi
40+
done
41+
}
42+
43+
install_system_packages() {
44+
45+
#Check/Install brew
46+
which -s brew
47+
if [[ $? != 0 ]] ; then
48+
echo "Installing Homebrew, as its not available"
49+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
50+
else
51+
echo "Hoebrew is installed now just updating it"
52+
brew update
53+
fi
54+
55+
#Check/Install base packages needed by aamp env
56+
echo "Check/Install aamp development environment base packages"
57+
58+
#Install XCode Command Line Tools
59+
base_macOSver=10.15
60+
ver=$(sw_vers | grep ProductVersion | cut -d':' -f2 | tr -d ' ')
61+
if [ $(echo -e $base_macOSver"\n"$ver | sort -V | tail -1) == "$base_macOSver" ];then
62+
echo "Install XCode Command Line Tools"
63+
xcode-select --install
64+
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_$ver.pkg -target /
65+
66+
else
67+
echo "New version of Xcode detected - XCode Command Line Tools Install not required"
68+
xcrun --sdk macosx --show-sdk-path
69+
### added fix for https://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error
70+
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
71+
fi
72+
73+
find_or_install_pkgs git cmake openssl libxml2 ossp-uuid cjson gnu-sed meson ninja
74+
75+
}
76+
77+
build_install_gst_and_custom_gst_plugins(){
78+
#Install Gstreamer and plugins
79+
echo "Installing GStreamer packages..."
80+
brew install gstreamer gst-validate gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-validate gst-libav
81+
82+
#Patch qtdemux plugin + Build and Install gstreamer 1.18.4 plugins
83+
84+
echo "Fetch,aamp custom patch(qtdemux),build and install gst-plugins-good-1.18.4.tar.xz ..."
85+
86+
curl -o gst-plugins-good-1.18.4.tar.xz https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.18.4.tar.xz
87+
tar -xvzf gst-plugins-good-1.18.4.tar.xz
88+
cd gst-plugins-good-1.18.4
89+
pwd
90+
patch -p1 < ../../OSx/patches/0009-qtdemux-aamp-tm_gst-1.16.patch
91+
patch -p1 < ../../OSx/patches/0013-qtdemux-remove-override-segment-event_gst-1.16.patch
92+
patch -p1 < ../../OSx/patches/0014-qtdemux-clear-crypto-info-on-trak-switch_gst-1.16.patch
93+
patch -p1 < ../../OSx/patches/0021-qtdemux-aamp-tm-multiperiod_gst-1.16.patch
94+
meson build
95+
ninja -C build
96+
ninja -C build install
97+
cd ../
98+
}
99+
100+
#Optional Command-line support for -b <aamp code branch> and -d <build directory>
101+
while getopts ":d:b:" opt; do
102+
case ${opt} in
103+
d ) # process option d install base directory name
104+
builddir=${OPTARG}
105+
echo "${OPTARG}"
106+
;;
107+
b ) # process option b code branch name
108+
codebranch=${OPTARG}
109+
;;
110+
* ) echo "Usage: $0 [-b aamp branch name] [-d local setup directory name]"
111+
exit
112+
;;
113+
esac
114+
done
115+
116+
#Check and if needed setup default aamp code branch name and local environment directory name
117+
if [[ $codebranch == "" ]]; then
118+
codebranch=${defaultcodebranch}
119+
echo "using default code branch: $defaultcodebranch"
120+
fi
121+
122+
if [[ "$builddir" == "" ]]; then
123+
124+
if [ -d "../../aamp" ]; then
125+
abs_path="$(cd "../../aamp" && pwd -P)"
126+
while true; do
127+
read -p '[!Alert!] Install script identified that the aamp folder already exists @ ../../aamp.
128+
Press Y, if you want to use same aamp folder (../../aamp) for your OSX simulator build.
129+
Press N, If you want to use separate build folder for aamp OSX simulator. Press (Y/N)' yn
130+
case $yn in
131+
[Yy]* ) builddir=$abs_path; echo "using following aamp build directory $builddir"; break;;
132+
[Nn]* ) builddir=${defaultbuilddir} ; echo "using following aamp build directory $PWD/$builddir"; break ;;
133+
* ) echo "Please answer yes or no.";;
134+
esac
135+
done
136+
137+
fi
138+
fi
139+
140+
if [[ ! -d "$builddir" ]]; then
141+
echo "Creating aamp build directory under $builddir";
142+
mkdir $builddir
143+
cd $builddir
144+
git clone -b $codebranch https://code.rdkcentral.com/r/rdk/components/generic/aamp
145+
cd aamp
146+
else
147+
cd $builddir
148+
149+
fi
150+
151+
#build all aamp supporting packages under lib folder
152+
mkdir -p build
153+
154+
echo "Builddir: $builddir"
155+
echo "Code Branch: $codebranch"
156+
157+
#Check if Xcode is installed
158+
if xpath=$( xcode-select --print-path ) &&
159+
test -d "${xpath}" && test -x "${xpath}" ; then
160+
echo "Xcode already installed. Skipping."
161+
162+
else
163+
echo "Installing Xcode…"
164+
xcode-select --install
165+
if xpath=$( xcode-select --print-path ) &&
166+
test -d "${xpath}" && test -x "${xpath}" ; then
167+
echo "Xcode installed now."
168+
else
169+
#... isn't correctly installed
170+
echo "Xcode installation not detected. Exiting $0 script."
171+
echo "Xcode installation is mandatory to use this AAMP installation automation script."
172+
echo "please check your app store for Xcode or check at https://developer.apple.com/download/"
173+
exit 0
174+
175+
fi
176+
fi
177+
178+
179+
180+
#Check OS=macOS
181+
if [[ "$OSTYPE" == "darwin"* ]]; then
182+
#Mac OSX
183+
echo $OSTYPE
184+
185+
install_system_packages
186+
187+
#Build aamp dependent modules
188+
echo "git clone aamp and dependent components in a new directory"
189+
190+
#cleanup old lib build
191+
if [ -d "./.lib" ]; then
192+
rm -rf ./.lib
193+
fi
194+
195+
mkdir .lib
196+
cd .lib
197+
198+
git clone -b $codebranch https://code.rdkcentral.com/r/rdk/components/generic/aampabr
199+
git clone -b $codebranch https://code.rdkcentral.com/r/rdk/components/generic/gst-plugins-rdk-aamp
200+
git clone -b $codebranch https://code.rdkcentral.com/r/rdk/components/generic/aampmetrics
201+
202+
build_install_gst_and_custom_gst_plugins
203+
204+
echo "Install libdash"
205+
mkdir temp
206+
cp ../install_libdash.sh ./temp
207+
cd temp
208+
209+
source ./install_libdash.sh
210+
cd ../../../
211+
212+
#Build aamp components
213+
echo "Building following aamp components"
214+
215+
#Build aampabr
216+
echo "Building aampabr..."
217+
pwd
218+
cd aampabr
219+
mkdir build
220+
cd build
221+
cmake ../
222+
make
223+
sudo make install
224+
cd ../..
225+
226+
#Build aampmetrics
227+
echo "Building aampmetrics..."
228+
cd aampmetrics
229+
mkdir build
230+
cd build
231+
cmake ..
232+
make
233+
sudo make install
234+
cd ../..
235+
236+
237+
#Build aamp-cli
238+
echo "Build aamp-cli"
239+
pwd
240+
cd ../
241+
242+
#clean existing build folder if exists
243+
if [ -d "./build" ]; then
244+
rm -rf ./build
245+
fi
246+
247+
mkdir -p build
248+
249+
cd build && PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/ssl/lib/pkgconfig:$PKG_CONFIG_PATH /usr/local/bin/cmake -DCMAKE_OSX_SYSROOT="/" -DCMAKE_OSX_DEPLOYMENT_TARGET="" -G Xcode ../
250+
251+
echo "Please Start XCode, open aamp/build/AAMP.xcodeproj project file"
252+
253+
##Create default channel ~/aampcli.csv – supports local configuration overrides
254+
echo "If not present, Create $HOME/aampcli.csv to suport virtual channel list of test assets that could be loaded in aamp-cli"
255+
256+
if [ -f "$defaultchannellistfile" ]; then
257+
echo "$defaultchannellistfile exists."
258+
else
259+
echo "$defaultchannellistfile does not exist. adding default test version"
260+
cp ../OSX/aampcli.csv $defaultchannellistfile
261+
fi
262+
263+
if [ -d "AAMP.xcodeproj" ]; then
264+
echo "AAMP Environment Sucessfully Installed."
265+
arr_install_status+=("AAMP Environment Sucessfully Installed.")
266+
else
267+
echo "AAMP Environment FAILED to Install."
268+
arr_install_status+=("AAMP Environment FAILED to Install.")
269+
fi
270+
271+
echo "Now Building aamp-cli"
272+
xcodebuild -scheme aamp-cli build
273+
274+
if [ -f "./Debug/aamp-cli" ]; then
275+
echo "OSX AAMP Build PASSED"
276+
arr_install_status+=("OSX AAMP Build PASSED")
277+
./Debug/aamp-cli https://cpetestutility.stb.r53.xcal.tv/VideoTestStream/main.mpd
278+
else
279+
echo "OSX AAMP Build FAILED"
280+
arr_install_status+=("OSX AAMP Build FAILED")
281+
fi
282+
283+
echo "Starting Xcode, open aamp/build/AAMP.xcodeproj project file OR Execute ./aamp-cli or /playbintest <url> binaries"
284+
echo "Opening AAMP project in Xcode..."
285+
286+
open AAMP.xcodeproj
287+
288+
echo ""
289+
echo "********AAMP install summery start************"
290+
291+
for item in "${!arr_install_status[@]}";
292+
do
293+
printf "$item ${arr_install_status[$item]} \n"
294+
done
295+
echo ""
296+
echo "********AAMP install summery end************"
297+
298+
299+
exit 0
300+
301+
#print final status of the script
302+
else
303+
304+
#abort the script if its not macOS
305+
echo "Aborting unsupported OS detected"
306+
echo $OSTYPE
307+
exit 1
308+
fi

0 commit comments

Comments
 (0)