Skip to content

Fall back to ANDROID_NDK if NDK not set#3064

Merged
Frenzie merged 3 commits intokoreader:masterfrom
marmistrz:kodev-arch
Aug 11, 2017
Merged

Fall back to ANDROID_NDK if NDK not set#3064
Frenzie merged 3 commits intokoreader:masterfrom
marmistrz:kodev-arch

Conversation

@marmistrz
Copy link
Copy Markdown
Contributor

No description provided.

kodev Outdated
;;
android)
if [ "$NDK" == "" ]; then
# Some distributions use `ANDROID_NDK` instead, fall back to it
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like this instead?

if [ -z "$NDK" ]; then
	if [ -z "$ANDROID_NDK" ]; then
		# some distributions use `ANDROID_NDK` instead, fall back to it
		export NDK=$ANDROID_NDK
	else
		export NDK="${CURDIR}/base/toolchain/android-ndk-r12b"
	fi
fi

Copy link
Copy Markdown
Contributor Author

@marmistrz marmistrz Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean

if [ -z "$NDK" ]; then
	if [ -z "$ANDROID_NDK" ]; then
		export NDK="${CURDIR}/base/toolchain/android-ndk-r12b"
	else
		# some distributions use `ANDROID_NDK` instead, fall back to it
		export NDK=$ANDROID_NDK
	fi
fi

Copy link
Copy Markdown
Member

@Frenzie Frenzie Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant [ -n ${ANDROID_NDK+x} ] (no -z, sorry for the typo) but it doesn't matter either way. It just feels inelegant to do the same check twice.

Edit: whoops, typod again and forgot the -n.

Copy link
Copy Markdown
Contributor Author

@marmistrz marmistrz Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So,

if [ ${NDK+x} ]; then
	if [ ${ANDROID_NDK+x} ]; then
		# some distributions use `ANDROID_NDK` instead, fall back to it
		export NDK=$ANDROID_NDK
	else
		export NDK="${CURDIR}/base/toolchain/android-ndk-r12b"
	fi
fi

Shouldn't it be if [ -z ${NDK+x} ]? https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should.

  • -z ${NDK+x} (unset or empty)
  • -n ${ANDROID_NDK+x} (set and non-empty)

@Frenzie Frenzie added the Android label Aug 9, 2017
@Frenzie Frenzie merged commit 128d60a into koreader:master Aug 11, 2017
@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Aug 11, 2017

Thanks! I hope you don't mind I went ahead and merged the discussed changes. :-)

Frenzie added a commit that referenced this pull request Aug 12, 2017
@marmistrz
Copy link
Copy Markdown
Contributor Author

Yeah, that's ok, I was a little busy back then :)

Frenzie added a commit to Frenzie/android-luajit-launcher that referenced this pull request Sep 16, 2017
There are different numbers all over the place, but I *think* the code points toward Android 4 (platform-14) as an intended target.

Also, by using `NDKABI=${NDKABI:-14}` we allow for environment variable overrides. It only sets the default of 14 if $NDKABI isn't set. This is in the same spirit as koreader/koreader#3064
Frenzie added a commit to Frenzie/android-luajit-launcher that referenced this pull request Sep 16, 2017
There are different numbers all over the place, but I *think* the code points toward Android 4 (platform-14) as an intended target.

Also, by using `NDKABI=${NDKABI:-14}` we allow for environment variable overrides. It only sets the default of 14 if $NDKABI isn't set. This is in the same spirit as koreader/koreader#3064
Frenzie added a commit to koreader/android-luajit-launcher that referenced this pull request Sep 16, 2017
There are different numbers all over the place, but I *think* the code points toward Android 4 (platform-14) as an intended target.

Also, by using `NDKABI=${NDKABI:-14}` we allow for environment variable overrides. It only sets the default of 14 if $NDKABI isn't set. This is in the same spirit as koreader/koreader#3064
Frenzie added a commit to Frenzie/koreader that referenced this pull request Sep 16, 2017
Part of the spirit of koreader#3064. Making it easier to test different things.
Frenzie added a commit that referenced this pull request Sep 16, 2017
Part of the spirit of #3064. Making it easier to test different things.
Frenzie added a commit to Frenzie/koreader that referenced this pull request Sep 17, 2017
Also improve SDK installation for ease of setting up development system.

This also puts in place most of the missing pieces to finish the intent in koreader#3064.
Frenzie added a commit that referenced this pull request Sep 17, 2017
Also improve SDK installation for ease of setting up development system.

This also puts in place most of the missing pieces to finish the intent in #3064.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants