Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Update] CocoaLibSpotify (2.1.0)

  • Loading branch information...
commit b77f3dc6181366f9bdfa8d2bd180b87eff9f9ec7 1 parent d30c97f
@kylefleming kylefleming authored
Showing with 68 additions and 0 deletions.
  1. +68 −0 CocoaLibSpotify/2.1.0/CocoaLibSpotify.podspec
View
68 CocoaLibSpotify/2.1.0/CocoaLibSpotify.podspec
@@ -0,0 +1,68 @@
+Pod::Spec.new do |s|
+ s.name = 'CocoaLibSpotify'
+ s.version = '2.1.0'
+ s.author = 'Spotify'
+ s.license = 'BSD 3-Clause'
+ s.homepage = 'https://github.com/spotify/cocoalibspotify'
+ s.summary = 'A Cocoa wrapper for libspotify.'
+ s.description = "CocoaLibSpotify is an Objective-C wrapper around our libspotify library. It provides easy access to libspotify's features in a friendly, KVC/O compliant Objective-C wrapper."
+ s.source = { :git => 'https://github.com/spotify/cocoalibspotify.git', :tag => "2.1.0" }
+ s.requires_arc = true
+
+ s.source_files = 'common', 'iOS Library/View Controllers', 'libspotify-12.1.45-iOS-universal/libspotify.framework/Headers'
+ s.resource = 'iOS Library/SPLoginResources.bundle'
+ s.frameworks = 'SystemConfiguration', 'CFNetwork', 'CoreAudio', 'AudioToolbox', 'AVFoundation', 'libspotify'
+ s.library = 'stdc++'
+ s.xcconfig = { 'OTHER_LDFLAGS' => '-all_load', 'FRAMEWORK_SEARCH_PATHS' => '$(PODS_ROOT)/CocoaLibSpotify/libspotify-12.1.45-iOS-universal' }
+ s.platform = :ios
+
+ def s.post_install(target)
+ # Note: Taken straight from the libspotify build script step
+ # TODO: All this should be put in a pre_install since it adds header files that need to get symlinked and added to the project file. In the meantime, pod install just needs to be run twice.
+ system <<-CMD
+python -c "
+import socket
+socket.setdefaulttimeout(60)
+import urllib
+import zipfile
+import os
+import sys
+import commands
+
+libspotifyFileName = \\"libspotify-12.1.45-iOS-universal.zip\\"
+libspotifyRemoteLocation = \\"http://developer.spotify.com/download/libspotify/\\"
+projectDir = os.path.join(\\"#{config.project_pods_root}\\", \\"cocoalibspotify\\")
+libspotifyDirectoryDir = os.path.join(projectDir, \\"libspotify-12.1.45-iOS-universal\\")
+libspotifyZipDir = os.path.join(projectDir, libspotifyFileName)
+
+if (os.path.exists(libspotifyDirectoryDir)):
+ #print \\"LibSpotify is present, no download needed.\\"
+ sys.exit(0)
+
+print \\"LibSpotify not present, downloading...\\"
+
+try:
+ urllib.urlretrieve(libspotifyRemoteLocation + libspotifyFileName, libspotifyZipDir)
+except OSError:
+ print \\"Could not download \\" + libspotifyRemoteLocation + libspotifyFileName + \\".\\"
+ sys.exit(1)
+
+unzipCommand = 'unzip -q \\"' + libspotifyZipDir + '\\"' + ' -d \\"' + projectDir + '\\"'
+unzipResult = commands.getstatusoutput(unzipCommand)
+
+if (unzipResult[0] != 0):
+ print \\"Could not untar \\" + libspotifyFileName + \\".\\"
+ sys.exit(1)
+
+commands.getstatusoutput('rm -rf \\"' + projectDir + '/__MACOSX\\"')
+
+try:
+ os.remove(libspotifyZipDir)
+except OSError:
+ print \\"Could not remove downloaded file.\\"
+
+print \\"Complete.\\"
+"
+CMD
+ end
+end

3 comments on commit b77f3dc

@alloy
Owner

@garthex I wonder if it’s possible to have a LibSpotify.podspec which pulls in just the libspotify-12.1.45-iOS-universal.zip file and sets up the search paths and have this spec depend on it. That way pod install wouldn’t have to be run twice either.

@kylefleming

@alloy That's what I was going to do initially, but I decided against it since it pollutes the repository with an inner lib, which seemed like a workaround. Thinking about it now, it actually makes sense to have a separate podspec since it's a lib that can stand on its own and it's conceivable someone might use it directly.

@kylefleming

@alloy libspotify itself isn't FOSS. Is it okay to put in the master repo?

Please sign in to comment.
Something went wrong with that request. Please try again.