djp952 / pvr.hdhomerundvr

Unofficial Kodi HDHomeRun DVR PVR Client
https://github.com/djp952/pvr.hdhomerundvr/wiki
Other
58 stars 9 forks source link

OSX version? #11

Closed drl123 closed 6 years ago

drl123 commented 6 years ago

Any possibility you can release one for Kodi 17 running on OSX?

djp952 commented 6 years ago

I hadn't really considered OSX, but it looks like there are some options for a cross-compile. I am an Apple-less individual so it may be trial and error :) I'll see what I can do for ya.

drl123 commented 6 years ago

I'd be happy to help out with the OSX compile part if you provide some instructions and any files that need to change. I'm a Ruby dev, not C++, but I do have the hardware! :-)

Most of my TV boxes are actually RPi's, but I do have a few iMac's in the house that I'd like to be able to connect without using the HDHomerunView app.

PS. Only been running your PVR for a few days (was using NextPVR previously), but nice work!

djp952 commented 6 years ago

Thanks! Sorry I disappeared for a bit, I'm definitely going to look into getting some done for ya here. Didn't want you to think I was ignoring ya :)

djp952 commented 6 years ago

Hi dr123, sadly I haven't been able to find any reliable way to compile code for OSX under Windows or Linux. I tried a couple things, neither of which really worked out and one trashed my Linux build environment pretty badly :)

We can definitely try building it on your system, the code should be portable to any recent GNU GCC/G++ compiler (I use 4.9 on Linux for compatibility, learned that early on), and it looks like GCC is an available option for native OSX. I could pull the Linux build steps out into a document for you, in theory the commands should be nearly identical.

Can you drop me a line at djp952@gmail.com sometime, I can get that document put together and we can see what happens!

drl123 commented 6 years ago

I've sent you a couple of emails, but maybe they are getting lost in spam or something. My email is don.lettrich@gmail.com If you can get me the instructions, I can certainly do the build for OSX

Thanks

richardgetz commented 6 years ago

I use an Apple TV with kodi and had no luck installing any of the other versions. I’d be happy to help with this also if there is a progress update.

djp952 commented 6 years ago

drl123 (et al), I kinda disappeared for a while there, I can only apologize and indicate that it was unavoidable. I did get your e-mails, but I seem to have lost them :( Anyway -- here's where I was on this. Before we can compile the PVR client, there are some pre-compiled dependencies that it needs that we need to figure out first. Specifically we will need to get libz, libuuid, and libcurl built into static libraries somehow. libcurl was a PAIN, but I now use it without SSL support so it's far easier than it was. libz and libuuid should be pretty easy in comparison.

I looked high and low for a way to do these things from Windows or Linux (legally), and came up with nothing. Even the most promising method, a toolset called osxcross, requires access to the proprietary SDK that's only available from a legit OSX set up. sigh.

If you guys are still interested and willing, I have my build steps for libz, libuuid, and libcurl for Windows and Linux documented pretty thoroughly here (libz): https://github.com/djp952/prebuilt-libz, here (libuuid): https://github.com/djp952/prebuilt-libuuid, and here (libcurl): https://github.com/djp952/prebuilt-libcurl-nossl.

For libz, the critical options are the -fPIC and --static options For libuuid, the critical options are --with-pic, --disable-shared, and --enable-static For libcurl the key options are --with-pic --disable-shared.

If we can get working static libraries for those 3 things, everything else is compiled from source. Sadly I really seem to have no way to do anything for OSX myself. Kinda sucks Apple keeps such a tight leash on their development environments :(

richardgetz commented 6 years ago

I have a paid dev account and macOS,iOS and tvOS devices. I’ll see what I can figure out when I get a free minute.

richardgetz commented 6 years ago

I believe I got decently far. This is the error where I get stuck:

/zlib/curl/pvr.hdhomerundvr/src/hdhomerundvr.vcxproj.metaproj : error MSB4025: The project file could not be loaded. Could not find file "/zlib/curl/pvr.hdhomerundvr/src/hdhomerundvr.vcxproj.metaproj".

I have the file named hdhomerundvr.vcxproj but not hdhomerundvr.vcxproj.metaproj.

djp952 commented 6 years ago

The .vcxproj (and .sln, and many other files) are the Visual Studio/Windows specific project files. If you have the static libraries (and if so, wow, quick work dude, it took me weeks to get those right!), the build for the PVR client on Linux-y platforms is done via a bunch of standalone commands. You can find them in the msbuild.proj file. Not sure exactly what MSBuild is complaining about with the .metaproj file, that's a temporary file. It may be because it's all set up for Windows, so it expects \ instead of / in the paths?

Anyway, here are the commands for Linux-y builds. This set is for Linux x86_64 and gcc version 4.9, which is closest to OSX, but a ton of things probably need to be changed (you'd probably want to look at the msbuild.proj file or copy/paste this into a real text editor, the lines are long. They would be executed from the repo root directory where the .sln and msbuild.proj files are:

export CPPFLAGS=-Wall -Wno-unknown-pragmas -I/usr/include/x86_64-linux-gnu -Idepends/xbmc/xbmc -Idepends/xbmc/xbmc/linux -Idepends/xbmc/xbmc/addons/kodi-addon-dev-kit/include/kodi -Idepends/libcurl-nossl/linux-x86_64/include/curl -Idepends/libuuid/linux-x86_64/include -Idepends/libhdhomerun -Idepends/sqlite -Itmp/version -L/usr/lib/gcc/x86_64-linux-gnu/4.9 export CFLAGS=-fPIC export CXXFLAGS=-fPIC -std=c++11

gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_channels.c -o out/linux-x86_64/hdhomerun_channels.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_channelscan.c -o out/linux-x86_64/hdhomerun_channelscan.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_control.c -o out/linux-x86_64/hdhomerun_control.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_debug.c -o out/linux-x86_64/hdhomerun_debug.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_device.c -o out/linux-x86_64/hdhomerun_device.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_device_selector.c -o out/linux-x86_64/hdhomerun_device_selector.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_discover.c -o out/linux-x86_64/hdhomerun_discover.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_os_posix.c -o out/linux-x86_64/hdhomerun_os_posix.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_pkt.c -o out/linux-x86_64/hdhomerun_pkt.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_sock_posix.c -o out/linux-x86_64/hdhomerun_sock_posix.o gcc-4.9 $CPPFLAGS $CFLAGS -c depends/libhdhomerun/hdhomerun_video.c -o out/linux-x86_64/hdhomerun_video.o gcc-4.9 $CPPFLAGS $CFLAGS -DSQLITE_THREADSAFE=2 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_TEMP_STORE=3 -c depends/sqlite/sqlite3.c -o out/linux-x86_64/sqlite3.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/database.cpp -o out/linux-x86_64/database.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/dbextension.cpp -o out/linux-x86_64/dbextension.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/dvrstream.cpp -o out/linux-x86_64/dvrstream.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/hdhr.cpp -o out/linux-x86_64/hdhr.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/pvr.cpp -o out/linux-x86_64/pvr.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/scheduler.cpp -o out/linux-x86_64/scheduler.o g++-4.9 $CPPFLAGS $CXXFLAGS -c src/sqlite_exception.cpp -o out/linux-x86_64/sqlite_exception.o g++-4.9 $CPPFLAGS -shared -Wl,--version-script=src/hdhomerundvr.map out/linux-x86_64/database.o out/linux-x86_64/dbextension.o out/linux-x86_64/hdhr.o out/linux-x86_64/hdhomerun_channels.o out/linux-x86_64/hdhomerun_channelscan.o out/linux-x86_64/hdhomerun_control.o out/linux-x86_64/hdhomerun_debug.o out/linux-x86_64/hdhomerun_device.o out/linux-x86_64/hdhomerun_device_selector.o out/linux-x86_64/hdhomerun_discover.o out/linux-x86_64/hdhomerun_os_posix.o out/linux-x86_64/hdhomerun_pkt.o out/linux-x86_64/hdhomerun_sock_posix.o out/linux-x86_64/hdhomerun_video.o out/linux-x86_64/dvrstream.o out/linux-x86_64/pvr.o out/linux-x86_64/scheduler.o out/linux-x86_64/sqlite3.o out/linux-x86_64/sqlite_exception.o depends/libcurl-nossl/linux-x86_64/lib/libcurl.a depends/libz/linux-x86_64/lib/libz.a depends/libuuid/linux-x86_64/lib/libuuid.a -ldl -lpthread -o out/linux-x86_64/zuki.pvr.hdhomerundvr.so gcc-4.9 $CPPFLAGS -DSQLITE_ENABLE_JSON1=1 depends/sqlite/sqlite3.c depends/sqlite/shell.c -o out/linux-x86_64/sqlite3 -ldl -lpthread

djp952 commented 6 years ago

It may have been the eggnog, but I just bought a used Core i5 Mac Mini from eBay, which will be here in late December. You guys owe me $341 if this works :) [Note: I don't ask for donations and I never will, I'm just kidding around here].

richardgetz commented 6 years ago

I’d like to be the first to officially congratulate you on the new edition to your family! Sorry I haven’t responded much I only have 2 weeks left of school then I will have more time to work on it. The Visual Studio stage is still tripping me up.

djp952 commented 6 years ago

Thanks, it arrived today. I've already gutted it and installed an old SSD, I think the HDD was bad (no system performs THAT slowly). Will probably need to splurge for at least 8GB of RAM, but I'm clean installing High Sierra now on said SSD and will get to work. I look like an idiot trying to navigate OSX with a PC keyboard :)

djp952 commented 6 years ago

Keeping in mind I've used OSX for all of one day ... I managed to hobble together a seemingly functional version for Krypton. In theory it should work on the same OSX versions that Kodi does (10.7-10.13, I think), but I honestly have no clue. Looks pretty good on OSX 10.13 with Kodi 17.6.

https://1drv.ms/f/s!AgEGEEVzGNq-itlEESqgf-tvlfXS8A (zuki.pvr.hdhomerundvr-osx-x86_64-krypton-1.2.7.6559.zip)

There is at least one thing I want to try and fix, the trick to not export all of the symbols from the libraries also used by Kodi (libcurl, SQLite) doesn't work on OSX. That caused a problem for some Linux distros. I'm sure there is a way, I just need to learn :)

This was all hand-compiled and packaged, there are no checkins or actual build support for this yet. Consider it a beta!

Would love to get feedback while I work on documenting and cleaning up the build process!

hunsra commented 6 years ago

Awesome! I would love to try it out! The link in your post doesn't seem to work. I get the following error:

onedrive

Can you repost?

Thanks!

djp952 commented 6 years ago

Looks like OneDrive is completely down right now, way to go Microsoft. Let's try attaching it here :)

zuki.pvr.hdhomerundvr-osx-x86_64-krypton-1.2.7.6559.zip

hunsra commented 6 years ago

So far, the OS X plugin seems to be working very well. Nice work! It found my HD HomeRun device and RECORD service, and my recordings. The guide works just as it does on Windows and Android, and FF/RW works just the same. I'll keep testing and let you know what I find. For reference, I'm using a Late 2012 Mac mini with macOS High Sierra (10.13.2) and Kodi 17.6

jingler commented 6 years ago

Brilliant, I have been waiting for this with much anticipation. Working well on my MacMini 2012. Thanks a lot.

djp952 commented 6 years ago

Glad it's working thus far! I'm working on the steps to build the addon from Windows now that I have the required SDK, using osxcross and gcc 4.9.3. I won't be sharing the generated toolset due to the Xcode / Apple licensing, but if it all works that way there will be a readme on how to generate it. If it doesn't work well that way, I'll just include a Makefile for OSX and build it on the Mac each time.

djp952 commented 6 years ago

This is now completed for all 3 baselines: Jarvis, Krypton, and Leia. I ultimately did get OSXCROSS to work now that I have the SDK, and so far it appears to be stable on the Mac Mini. Since I redid the builds to allow for more granular targeting, I have to retest pretty much all of them, so once I check Jarvis and Leia out on the real Mac, I think this can be closed out. Please of course let me know of any defects you find!!

I was also able to resolve my outstanding issue, which was how to limit the functions exported from the .dylib file to just what's necessary. That should prevent any possibility of the weirdness that was seen on Linux where having a statically linked version of SQLite that is newer than Kodi's made things go a little wonky for some folks.

Looks pretty good to me overall, and I'm very happy to have been able to include another platform, thank you so much for the request and of course all of your assistance and feedback!!!

Starting the countdown for when iOS/darwin support is requested next :) Shouldn't be much harder, really, and of course now I have a legit iOS emulator too ....

richardgetz commented 6 years ago

If you end up having the ability to run it for tvOS (very similar to iOS) that is my end goal. I’m on holiday still and will try to help when I return. Awesome to see the quick work!

djp952 commented 6 years ago

I think this particular issue can be considered 'closed' since v1.2.8 is out and officially has the OSX build (and it still seems to work!). I saw a report on the SD forums from someone with all kinds of problems, but my guess is that it was network related and just not understanding some of the inherent weirdness and limitations of the client.

If you guys run into problems, please let me know of course!

I'll open a new Enhancement issue for tvOS/iOS support. I imagine it won't be too terribly difficult now that we have a build process for OSX :)

drl123 commented 6 years ago

@djp952 Sorry I was out of the country for the last few weeks and just got to test this today. Works great. Thanks for all of your efforts!