Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/Krypton-apk' into K…
Browse files Browse the repository at this point in the history
…rypton
  • Loading branch information
djp952 committed Apr 1, 2017
2 parents c37f810 + 074a2c8 commit 5cec97d
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,7 @@ paket-files/
# Temporary Directories
tmp/
out/

# Java Keystores
*.jks
*.keystore
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@
[submodule "libcurl-nossl"]
path = depends/libcurl-nossl
url = https://github.com/djp952/prebuilt-libcurl-nossl.git
[submodule "kodi-apks"]
path = depends/kodi-apks
url = https://github.com/djp952/prebuilt-kodi-apks.git
[submodule "apktool"]
path = depends/apktool
url = https://github.com/djp952/prebuilt-apktool.git
55 changes: 46 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# __pvr.hdhomerundvr__

Unofficial Kodi HDHomeRun DVR PVR Client
## [__DOCUMENTATION AND DOWNLOADS__](https://github.com/djp952/pvr.hdhomerundvr/wiki)
## [__USER DOCUMENTATION AND DOWNLOADS__](https://github.com/djp952/pvr.hdhomerundvr/wiki)

Copyright (C)2017 Michael G. Brehm
[MIT LICENSE](https://opensource.org/licenses/MIT)
Expand All @@ -14,7 +14,9 @@ Copyright (C)2017 Michael G. Brehm
* Windows 10 x64 15063
* Visual Studio 2015 (with Git for Windows)
* Bash on Ubuntu on Windows 16.04.1 LTS
* Android NDK r12b for Windows 64-bit
* Android NDK r12b for Windows 64-bit
* Optional: Android SDK tools r25.2.3 for Windows
* Optional: Oracle Java SE Runtime Environment 8

**CONFIGURE BASH ON UBUNTU ON WINDOWS**
Open "Bash on Ubuntu on Windows"
Expand All @@ -30,16 +32,36 @@ Download the Android NDK r12b for Windows 64-bit:
[https://dl.google.com/android/repository/android-ndk-r12b-windows-x86_64.zip](https://dl.google.com/android/repository/android-ndk-r12b-windows-x86_64.zip)

* Extract the contents of the .zip file somewhere
* Set a System Environment Variable named ANDROID_NDK_ROOT that points to the extraction location (android-ndk-r12b)
* Optionally, ANDROID_NDK_ROOT can also be set on the command line prior to executing msbuild:
* Set a System Environment Variable named ANDROID_NDK_ROOT that points to the extracted android-ndk-r12b folder

**CONFIGURE ANDROID SDK TOOLS (OPTIONAL)**
_Android SDK tools are only required for Android APK generation; see "BUILD AND GENERATE MODIFIED KODI ANDROID APKS" below_

Download the Android SDK tools r25.2.3 for Windows:
[https://dl.google.com/android/repository/tools_r25.2.3-windows.zip](https://dl.google.com/android/repository/tools_r25.2.3-windows.zip)

* Extract the contents of the .zip file somewhere
* Set a System Environment Variable named ANDROID_SDK_ROOT that points to the location the .zip was extracted
* Install the build-tools-25.0.2 package:
```
...
set ANDROID_NDK_ROOT=D:\android-ndk-r12b
msbuild msbuild.proj
...
cd /d %ANDROID_SDK_ROOT%\tools
android update sdk --all -u -t build-tools-25.0.2
```

**CONFIGURE ORACLE JAVA SE RUNTIME ENVIRONMENT (OPTIONAL)**
_Oracle Java SE Runtime Environment is only required for Android APK generation; see "BUILD AND GENERATE MODIFIED KODI ANDROID APKS" below_

Download the latest jre-8xxx-windows-x64.tar.gz from Oracle:
[Java SE Runtime Environment 8 - Downloads](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)

* Extract the contents of the jre-8xxx-windows-x64.tar.gz file somewhere
* Set a System Environment Variable named JAVA_HOME that points to the location the tar.gz was extracted
* Test Java:
```
%JAVA_HOME%\bin\java -version
```

**BUILD**
**BUILD AND GENERATE KODI ADDON PACKAGES**
Open "Developer Command Prompt for VS2015"
```
git clone https://github.com/djp952/pvr.hdhomerundvr -b Krypton
Expand All @@ -59,6 +81,21 @@ msbuild msbuild.proj
> out\zuki.pvr.hdhomerundvr-android-x86-krypton-x.x.x.x.zip (android-x86)
```

**BUILD AND GENERATE MODIFIED KODI ANDROID APKS**
Building the modified Kodi Android APKs requires a Java keystore to be specified on the build command line in order to sign the resultant APK files. For more information about APK signing and how to generate the keystore, please see [Sign Your App](https://developer.android.com/studio/publish/app-signing.html).

Open "Developer Command Prompt for VS2015"
```
git clone https://github.com/djp952/pvr.hdhomerundvr -b Krypton
cd pvr.hdhomerundvr
git submodule update --init
msbuild msbuild.proj /t:PackageApk /p:Keystore={path_to_keystore};KeystorePassword={keystore_password}
> out\kodi-x.x-zuki.pvr.hdhomerundvr-arm-x.x.x.x.apk (android-arm)
> out\kodi-x.x-zuki.pvr.hdhomerundvr-aarch64-x.x.x.x.apk (android-aarch64)
> out\kodi-x.x-zuki.pvr.hdhomerundvr-x86-x.x.x.x.apk (android-x86)
```

**LIBHDHOMERUN LICENSE INFORMATION**
[https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic](https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic)
This library statically links with code licensed under the GNU Lesser Public License, v2.1 [(LGPL 2.1)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html). As per the terms of that license, the maintainer (djp952) must provide the library in an object (or source) format and allow the user to modify and relink against a different version(s) of the LGPL 2.1 libraries. To use a different or custom version of libhdhomerun the user may alter the contents of the depends/libhdhomerun source directory prior to building this library.
1 change: 1 addition & 0 deletions depends/apktool
Submodule apktool added at 00287e
1 change: 1 addition & 0 deletions depends/kodi-apks
Submodule kodi-apks added at 1bffb6
76 changes: 76 additions & 0 deletions msbuild.proj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,25 @@
<PropertyGroup>
<Configuration>Release</Configuration>
<KodiBaseline>krypton</KodiBaseline>
<Keystore></Keystore> <!-- must be set on command line with /p:Keystore=xxx -->
<KeystorePassword></KeystorePassword> <!-- must be set on command line with /p:KeystorePassword=xxx -->
</PropertyGroup>

<!-- ReplaceInFile: Replaces text in a file based on a regular expression -->
<UsingTask TaskName="ReplaceInFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<filename ParameterType="System.String" Required="true"/>
<match ParameterType="System.String" Required="true"/>
<replacewith ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Core"/>
<Code Type="Fragment" Language="cs">
<![CDATA[System.IO.File.WriteAllText(filename, System.Text.RegularExpressions.Regex.Replace(System.IO.File.ReadAllText(filename), match, replacewith));]]>
</Code>
</Task>
</UsingTask>

<Target Name="Clean">
<MSBuild Projects="pvr.hdhomerundvr.sln" Properties="Configuration=$(Configuration);Platform=Win32" Targets="Clean" ContinueOnError="false"/>
<MSBuild Projects="pvr.hdhomerundvr.sln" Properties="Configuration=$(Configuration);Platform=x64" Targets="Clean" ContinueOnError="false"/>
Expand Down Expand Up @@ -226,4 +243,63 @@
<Exec Command="&quot;$(ZipperExe)&quot; create &quot;$(PackageFile-android-x86)&quot; manifest\android-x86.manifest" ContinueOnError="false"/>
</Target>

<Target Name="PackageApk" DependsOnTargets="Package">

<Error Condition="'$(ANDROID_SDK_ROOT)' == ''" Text="Environment variable ANDROID_SDK_ROOT has not been set"/>
<Error Condition="'$(JAVA_HOME)' == ''" Text="Environment variable JAVA_HOME has not been set"/>
<Error Condition="'$(Keystore)' == ''" Text="Variable Keystore has not been set; specify with /p:Keystore=xxx;KeystorePassword=xxx"/>
<Error Condition="'$(KeystorePassword)' == ''" Text="Variable KeystorePassword has not been set; specify with /p:Keystore=xxx;KeystorePassword=xxx"/>

<!-- This task requires a lot of hard-coded paths and versions; keep everything that is subject to change as Properties -->
<PropertyGroup>
<ApkToolJar>apktool_2.2.2.jar</ApkToolJar>
<ZipAlignExe>$(ANDROID_SDK_ROOT)\build-tools\25.0.2\zipalign</ZipAlignExe>
<ApkSignerExe>$(ANDROID_SDK_ROOT)\build-tools\25.0.2\apksigner</ApkSignerExe>
<PackageVersion>$([System.IO.File]::ReadAllText(tmp\version\version.txt))</PackageVersion>
<BuildNumber>$([System.Version]::Parse($(PackageVersion)).Revision)</BuildNumber>
<ApkVersionCode>1710$(BuildNumber)</ApkVersionCode>
<ApkVersionName>17.1-zuki.pvr.hdhomerundvr-$(PackageVersion)</ApkVersionName>
<PackageFile-android-arm>out\zuki.pvr.hdhomerundvr-android-arm-$(KodiBaseline)-$(PackageVersion).zip</PackageFile-android-arm>
<PackageFile-android-aarch64>out\zuki.pvr.hdhomerundvr-android-aarch64-$(KodiBaseline)-$(PackageVersion).zip</PackageFile-android-aarch64>
<PackageFile-android-x86>out\zuki.pvr.hdhomerundvr-android-x86-$(KodiBaseline)-$(PackageVersion).zip</PackageFile-android-x86>
<KodiApk-android-arm>kodi-17.1-Krypton-armeabi-v7a</KodiApk-android-arm>
<KodiApk-android-aarch64>kodi-17.1-Krypton-arm64-v8a</KodiApk-android-aarch64>
<KodiApk-android-x86>kodi-17.1-Krypton-x86</KodiApk-android-x86>
<ZukiApk-android-arm>kodi-17.1-zuki.pvr.hdhomerundvr-arm-$(PackageVersion)</ZukiApk-android-arm>
<ZukiApk-android-aarch64>kodi-17.1-zuki.pvr.hdhomerundvr-aarch64-$(PackageVersion)</ZukiApk-android-aarch64>
<ZukiApk-android-x86>kodi-17.1-zuki.pvr.hdhomerundvr-x86-$(PackageVersion)</ZukiApk-android-x86>
</PropertyGroup>

<!-- android-arm -->
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) d -p out\$(KodiApk-android-arm)-framework -s depends\kodi-apks\$(KodiApk-android-arm).apk -o out\$(KodiApk-android-arm)" ContinueOnError="false"/>
<ReplaceInFile filename="out\$(KodiApk-android-arm)\apktool.yml" match="versionCode:\s*'\d*'" replacewith="versionCode: '$(ApkVersionCode)'"/>
<ReplaceInFile filename="out\$(KodiApk-android-arm)\apktool.yml" match="versionName:\s*'.*'" replacewith="versionName: '$(ApkVersionName)'" />
<Exec Command="PowerShell Expand-Archive -Path $(PackageFile-android-arm) -DestinationPath out\$(KodiApk-android-arm)\assets\addons\" ContinueOnError="false"/>
<Copy SourceFiles="out\armeabi-v7a\libhdhomerundvr.so" DestinationFiles="out\$(KodiApk-android-arm)\lib\armeabi-v7a\libhdhomerundvr.so" ContinueOnError="false"/>
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) b -p out\$(KodiApk-android-arm)-framework out\$(KodiApk-android-arm)" ContinueOnError="false"/>
<Exec Command="&quot;$(ZipAlignExe)&quot; -f -p 4 out\$(KodiApk-android-arm)\dist\$(KodiApk-android-arm).apk out\$(KodiApk-android-arm)\dist\$(KodiApk-android-arm)-aligned.apk" ContinueOnError="false"/>
<Exec Command="&quot;$(ApkSignerExe)&quot; sign --ks $(Keystore) --ks-pass pass:$(KeystorePassword) --out out\$(ZukiApk-android-arm).apk out\$(KodiApk-android-arm)\dist\$(KodiApk-android-arm)-aligned.apk" ContinueOnError="false"/>

<!-- android-aarch64 -->
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) d -p out\$(KodiApk-android-aarch64)-framework -s depends\kodi-apks\$(KodiApk-android-aarch64).apk -o out\$(KodiApk-android-aarch64)" ContinueOnError="false"/>
<ReplaceInFile filename="out\$(KodiApk-android-aarch64)\apktool.yml" match="versionCode:\s*'\d*'" replacewith="versionCode: '$(ApkVersionCode)'"/>
<ReplaceInFile filename="out\$(KodiApk-android-aarch64)\apktool.yml" match="versionName:\s*'.*'" replacewith="versionName: '$(ApkVersionName)'" />
<Exec Command="PowerShell Expand-Archive -Path $(PackageFile-android-aarch64) -DestinationPath out\$(KodiApk-android-aarch64)\assets\addons\" ContinueOnError="false"/>
<Copy SourceFiles="out\arm64-v8a\libhdhomerundvr.so" DestinationFiles="out\$(KodiApk-android-aarch64)\lib\arm64-v8a\libhdhomerundvr.so" ContinueOnError="false"/>
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) b -p out\$(KodiApk-android-aarch64)-framework out\$(KodiApk-android-aarch64)" ContinueOnError="false"/>
<Exec Command="&quot;$(ZipAlignExe)&quot; -f -p 4 out\$(KodiApk-android-aarch64)\dist\$(KodiApk-android-aarch64).apk out\$(KodiApk-android-aarch64)\dist\$(KodiApk-android-aarch64)-aligned.apk" ContinueOnError="false"/>
<Exec Command="&quot;$(ApkSignerExe)&quot; sign --ks $(Keystore) --ks-pass pass:$(KeystorePassword) --out out\$(ZukiApk-android-aarch64).apk out\$(KodiApk-android-aarch64)\dist\$(KodiApk-android-aarch64)-aligned.apk" ContinueOnError="false"/>

<!-- android-x86 -->
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) d -p out\$(KodiApk-android-x86)-framework -s depends\kodi-apks\$(KodiApk-android-x86).apk -o out\$(KodiApk-android-x86)" ContinueOnError="false"/>
<ReplaceInFile filename="out\$(KodiApk-android-x86)\apktool.yml" match="versionCode:\s*'\d*'" replacewith="versionCode: '$(ApkVersionCode)'"/>
<ReplaceInFile filename="out\$(KodiApk-android-x86)\apktool.yml" match="versionName:\s*'.*'" replacewith="versionName: '$(ApkVersionName)'" />
<Exec Command="PowerShell Expand-Archive -Path $(PackageFile-android-x86) -DestinationPath out\$(KodiApk-android-x86)\assets\addons\" ContinueOnError="false"/>
<Copy SourceFiles="out\x86\libhdhomerundvr.so" DestinationFiles="out\$(KodiApk-android-x86)\lib\x86\libhdhomerundvr.so" ContinueOnError="false"/>
<Exec Command="(set ANDROID_AAPT_IGNORE=&quot;&quot;) &amp; &quot;$(JAVA_HOME)\bin\java&quot; -jar -Duser.language-en depends\apktool\$(ApkToolJar) b -p out\$(KodiApk-android-x86)-framework out\$(KodiApk-android-x86)" ContinueOnError="false"/>
<Exec Command="&quot;$(ZipAlignExe)&quot; -f -p 4 out\$(KodiApk-android-x86)\dist\$(KodiApk-android-x86).apk out\$(KodiApk-android-x86)\dist\$(KodiApk-android-x86)-aligned.apk" ContinueOnError="false"/>
<Exec Command="&quot;$(ApkSignerExe)&quot; sign --ks $(Keystore) --ks-pass pass:$(KeystorePassword) --out out\$(ZukiApk-android-x86).apk out\$(KodiApk-android-x86)\dist\$(KodiApk-android-x86)-aligned.apk" ContinueOnError="false"/>

</Target>

</Project>
2 changes: 1 addition & 1 deletion src/version.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
Company=Michael G. Brehm
Copyright=
Product=zuki.pvr.hdhomerundvr
Version=1.0.5
Version=1.0.6

0 comments on commit 5cec97d

Please sign in to comment.