Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add podspec #27

Closed
wants to merge 1 commit into from
Closed

Add podspec #27

wants to merge 1 commit into from

Conversation

phatmann
Copy link
Contributor

I created a podspec file so CoreParse can be used with CocoaPods. If you approve, I can push the podspec file to the CocoaPods Specs repo.

I am integrating CoreParse with NUI (https://github.com/tombenner/nui) and CoreParse will be a dependency.

@tombenner
Copy link

+1

@beelsebob
Copy link
Owner

I already had a pod spec for CoreParse, it was more work than it was worth maintaining two build systems. There's a perfectly good build system in place already. Please use it if you want to use the code.

@beelsebob beelsebob closed this Jan 19, 2014
@phatmann
Copy link
Contributor Author

NUI is commonly installed via CocoaPods. In order for CoreParse to be a dependency it needs to be in a pod.

We could place the podspec file only in the CocoaPods Specs repo instead of here, and I could be responsible for maintaining it. Are you comfortable with that?

@beelsebob
Copy link
Owner

No, this is the way it worked in the past, it required substantial work on my part to make sure that the pod spec actually reflected the state CoreParse should be in. If NUI wants to use CoreParse, they can specify the dependancy just like any other sane project – by using a submodule, and setting up an implicit (or explicit if they choose) project dependancy in Xcode.

@haifengkao
Copy link

That's too bad :(

@siuying
Copy link
Contributor

siuying commented Jan 22, 2014

@beelsebob What if a podspec that use xcodeproj to build the library? This could almost ensure the library compiled will be same as what you intended in xcode project, but also allow we manage project dependency.

Pod::Spec.new do |m|
  m.name    = 'CoreParse'
  m.version = '0.0.1'

  m.summary     = 'A shift/reduce parsing framework for Mac OS X and iOS.'
  m.description = 'A shift/reduce parsing framework for Mac OS X and iOS.'
  m.homepage    = 'https://github.com/beelsebob/CoreParse'
  m.license     = {:type => 'BSD', :file => 'LICENSE'}
  m.author      = { 'Thomas Davie' => 'beelsebob' }

  m.source = { :git => 'https://github.com/beelsebob/CoreParse.git' }
  m.ios.deployment_target = '4.3'
  m.osx.deployment_target = '10.6'

  m.source_files = 'CoreParse/**/*.h'
  m.public_header_files = 'CoreParse/**/*.h'
  m.exclude_files = 'CoreParse/CPSenTestKitAssertions.h'
  m.requires_arc = false

  # build the project using xcodebuild for simulator and device, then use lipo to combine the library
  m.prepare_command = <<-CMD
      xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS="armv7 armv7s arm64" VALID_ARCHS="armv7 armv7s arm64" -project CoreParse.xcodeproj -target iOSCoreParse -sdk iphoneos CONFIGURATION_BUILD_DIR=iphoneos 2>&1 > /dev/null
      xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS="x86_64 i386" VALID_ARCHS="x86_64 i386" -project CoreParse.xcodeproj -target iOSCoreParse -sdk iphonesimulator CONFIGURATION_BUILD_DIR=iphonesimulator  2>&1 > /dev/null
      lipo -create -output "libCoreParse.a" "iphoneos/libCoreParse.a" "iphonesimulator/libCoreParse.a"
  CMD

  m.library = 'CoreParse'

  m.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load', 'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/CoreParse"' }

  m.preserve_paths = 'libCoreParse.a', 'CoreParse.xcodeproj'
end

(above only include the iOS library, need a better way to implement a universal solution)

@beelsebob
Copy link
Owner

I'm sorry, after my first experience with CocoaPods I'm completely unwilling to support what they're doing. I see the entire project as doing irreparable damage to the way that iOS developers think about and use libraries. I would really rather than dependent projects simply used a git submodule, and did the appropriate thing.

@siuying
Copy link
Contributor

siuying commented Jan 23, 2014

A version of podspec that include both OSX framework and iOS library:

Pod::Spec.new do |m|
  m.name    = 'CoreParse'
  m.version = '0.0.1'

  m.summary     = 'A shift/reduce parsing framework for Mac OS X and iOS.'
  m.description = 'A shift/reduce parsing framework for Mac OS X and iOS.'
  m.homepage    = 'https://github.com/beelsebob/CoreParse'
  m.license     = {:type => 'BSD', :file => 'LICENSE'}
  m.author      = { 'Thomas Davie' => 'beelsebob' }

  m.source = { :git => 'https://github.com/beelsebob/CoreParse.git', :commit => 'a429b6b7c6a715bb1b5fd10cba42aaf3301a86a2'}
  m.ios.deployment_target = '4.3'
  m.osx.deployment_target = '10.6'

  m.source_files = 'CoreParse/**/*.h'
  m.public_header_files = 'CoreParse/**/*.h'
  m.exclude_files = 'CoreParse/CPSenTestKitAssertions.h'
  m.requires_arc = false

  m.prepare_command = <<-CMD
      # build universal library for iOS
      xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS="armv7 armv7s arm64" VALID_ARCHS="armv7 armv7s arm64" -project CoreParse.xcodeproj -target iOSCoreParse -sdk iphoneos CONFIGURATION_BUILD_DIR=iphoneos 2>&1 > /dev/null

      xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS="i386" VALID_ARCHS="i386" -project CoreParse.xcodeproj -target iOSCoreParse -sdk iphonesimulator CONFIGURATION_BUILD_DIR=iphonesimulator  2>&1 > /dev/null

      lipo -create -output "libCoreParse.a" "iphoneos/libCoreParse.a" "iphonesimulator/libCoreParse.a"

      # build Mac Framework
      xcodebuild ONLY_ACTIVE_ARCH=NO ARCHS="x86_64" VALID_ARCHS="x86_64" -project CoreParse.xcodeproj -target CoreParse -sdk macosx CONFIGURATION_BUILD_DIR=.
  CMD

  m.ios.library = 'CoreParse'
  m.ios.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load', 'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/CoreParse"' }

  m.osx.vendored_framework = "CoreParse.framework"
  m.osx.resource = "CoreParse.framework"
  m.osx.xcconfig = { 'LD_RUNPATH_SEARCH_PATHS' => '@loader_path/../Frameworks' }

  m.preserve_paths = 'libCoreParse.a', 'CoreParse.framework', 'CoreParse.xcodeproj'
end

@siuying
Copy link
Contributor

siuying commented Jan 23, 2014

I respect your opinion, but some people do interested to use CocoaPod. I can try to find a way to make it just use your project setting, maintain it should require minimal effort.

People like to use the latest version (instead of tagged version) of the library just need to do something like:

pod 'CoreParse', :head 

Without a CoreParse spec on official repo other projects will have to fallback to manual installation, embed the static library or embed a forked CoreParse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants