Skip to content

Commit

Permalink
Merge branch 'tenzap-f_go_edition'
Browse files Browse the repository at this point in the history
  • Loading branch information
mfonville committed Jun 11, 2022
2 parents 897620f + 6c6b593 commit f6d7696
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 36 deletions.
3 changes: 2 additions & 1 deletion add_sourceapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
# GNU General Public License for more details.
#

TOP=$(cd "${0%/*}" && pwd -P) || exit 1
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; TOP=$(cd "$a"; pwd -P) || exit 1
CACHE="$TOP/cache"
SOURCES="$TOP/sources"
GO_DIR_SUFFIX="-go"
SCRIPTS="$TOP/scripts"
CERTIFICATES="$SCRIPTS/certificates"
APKTOOL="$SCRIPTS/apktool-resources/apktool_2.6.1.jar"
Expand Down
2 changes: 1 addition & 1 deletion get_speechfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# GNU General Public License for more details.
#

TOP=$(cd "${0%/*}" && pwd -P) || exit 1
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; TOP=$(cd "$a"; pwd -P) || exit 1
SOURCES="$TOP/sources"
SCRIPTS="$TOP/scripts"
SPEECHFOLDER="$SOURCES/all/usr/srec/en-US"
Expand Down
2 changes: 1 addition & 1 deletion report_sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# GNU General Public License for more details.
#

TOP=$(cd "${0%/*}" && pwd -P) || exit 1
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; TOP=$(cd "$a"; pwd -P) || exit 1
CACHE="$TOP/cache"
SOURCES="$TOP/sources"
SCRIPTS="$TOP/scripts"
Expand Down
15 changes: 14 additions & 1 deletion scripts/build_gapps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ if [ -n "$OPENGAPPSDATE" ]; then
else
DATE=$(date +"%Y%m%d")
fi
TOP=$(cd "${0%/*}"/.. && pwd -P) || exit 1
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; TOP=$(cd "$a/.."; pwd -P) || exit 1
ARCH="$1"
API="$2"
VARIANT="$3"
BUILD="$TOP/build"
CACHE="$TOP/cache"
SOURCES="$TOP/sources"
GO_DIR_SUFFIX="-go"
SCRIPTS="$TOP/scripts"
CERTIFICATES="$SCRIPTS/certificates"
#CERTIFICATEFILE="" # this can be set to a filepath to use as certificate file for signing
Expand Down Expand Up @@ -96,6 +97,17 @@ if [ -z "$SUPPORTEDVARIANTS" ]; then
echo "ERROR: Unknown variant! aborting..."
exit 1
fi

case "$VARIANT" in
*_go)
if [ "$API" -lt "27" ]; then
echo "ERROR! Go edition cannot be built on API level $API. Go edition appeared with API 27.
More info here: https://developer.android.com/docs/quality-guidelines/build-for-billions/device-capacity#androidgo"
exit 1
fi
;;
esac

if [ "$ARCH" != "arm" ] && [ "$ARCH" != "arm64" ]; then #For all non-arm(64) platforms
case "$VARIANT" in
aroma)
Expand Down Expand Up @@ -134,6 +146,7 @@ api27hack #only here for completeness
api28hack #only on 9.0+ we also include Actions Services, AndroidPlatformServices, Data Transfer Tool, Markup, Sounds
api29hack #only on 10.0+ we also include Actions Services with Pixel Launcher and TrichromeLibrary with Chrome and Webview
api30hack #only on 11.0+ we also include Actions Services with Pixel Launcher and TrichromeLibrary with Chrome and Webview
gohack #Create go variants based on the non-go variants
buildtarget
alignbuild
commonscripts
Expand Down
15 changes: 10 additions & 5 deletions scripts/inc.buildhelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ buildfile() {
printf "%6s | %-s\n" "$usearch" "$1">> "$logfile"
fi
copy "$SOURCES/$usearch/$1" "$targetdir" #if we have a file specific to this architecture
# rename etc/sysconfig/google_go.xml to etc/sysconfig/google.xml
if [ "$1" = "etc/sysconfig/google_go.xml" ]; then
mv "$targetdir/google_go.xml" "$targetdir/google.xml"
fi
else
get_fallback_arch "$usearch"
if [ "$usearch" != "$fallback_arch" ]; then
Expand Down Expand Up @@ -167,10 +171,11 @@ buildapp() {
targetlocation="$4"
if [ -z "$5" ]; then usearch="$ARCH"
else usearch="$5"; fi #allows for an override
packagedirsuffix="$6"

minapihack #Some packages need a minimal api level to maintain compatibility with the OS

if getapksforapi "$package" "$usearch" "$usemaxapi" "$useminapi"; then
if getapksforapi "$package" "$usearch" "$usemaxapi" "$useminapi" "$packagedirsuffix"; then
baseversionname=""
for dpivariant in $(echo "$sourceapks" | tr ' ' ''); do #we replace the spaces with a special char to survive the for-loop
dpivariant="$(echo "$dpivariant" | tr '' ' ')" #and we place the spaces back again
Expand Down Expand Up @@ -209,7 +214,7 @@ buildapp() {
else
get_fallback_arch "$usearch"
if [ "$usearch" != "$fallback_arch" ]; then
buildapp "$package" "$usemaxapi" "$ziplocation" "$targetlocation" "$fallback_arch"
buildapp "$package" "$usemaxapi" "$ziplocation" "$targetlocation" "$fallback_arch" "$packagedirsuffix"
else
echo "ERROR: No fallback available. Failed to build package $package"
exit 1
Expand All @@ -219,11 +224,11 @@ buildapp() {

getapksforapi() {
#this functions finds the highest available acceptable apk for a given api and architecture
#$1 package, $2 arch, $3 api, $4 minapi
#$1 package, $2 arch, $3 api, $4 minapi, $5 packagedirsuffix
if [ -z "$4" ]; then minapi="0"
else minapi="$4"; fi #specify minimal api

if ! stat --printf='' "$SOURCES/$2/"*"app/$1" 2>/dev/null; then
if ! stat --printf='' "$SOURCES/$2/"*"app$5/$1" 2>/dev/null; then
return 1 #appname is not there, error!?
fi

Expand All @@ -233,7 +238,7 @@ getapksforapi() {
" #We set IFS to newline here so that spaces can survive the for loop
#sed copies filename to the beginning, to compare version, and later we remove it with cut
maxsdkerrorapi=""
for foundapk in $(find $SOURCES/$2/*app/$1 -iname '*.apk' 2>/dev/null| sed 's!.*/\(.*\)!\1/&!' | sort -r -n -t/ -k1,1 | cut -d/ -f2-); do
for foundapk in $(find $SOURCES/$2/*app$5/$1 -iname '*.apk' 2>/dev/null| sed 's!.*/\(.*\)!\1/&!' | sort -r -n -t/ -k1,1 | cut -d/ -f2-); do
foundpath="$(dirname "$(dirname "$foundapk")")"
api="$(basename "$foundpath")"
if [ "$maxsdkerrorapi" = "$api" ]; then
Expand Down
Loading

0 comments on commit f6d7696

Please sign in to comment.