From ec300d16a99ee3eb22c8235f111ed050ab80b5cb Mon Sep 17 00:00:00 2001 From: twelve17 Date: Wed, 11 Nov 2015 16:26:52 -0500 Subject: [PATCH 01/13] Remove unused CMake code. Remove patch, as it was accepted in the openalpr repo. --- etc/cmake/OpenALPR_CMakeLists.txt.patch | 123 ------------------------ etc/cmake/Toolchains/iOS.cmake | 20 +--- 2 files changed, 2 insertions(+), 141 deletions(-) delete mode 100644 etc/cmake/OpenALPR_CMakeLists.txt.patch diff --git a/etc/cmake/OpenALPR_CMakeLists.txt.patch b/etc/cmake/OpenALPR_CMakeLists.txt.patch deleted file mode 100644 index 7dd2288..0000000 --- a/etc/cmake/OpenALPR_CMakeLists.txt.patch +++ /dev/null @@ -1,123 +0,0 @@ -diff --git a/.gitignore b/.gitignore -index 85221c7..f9f1fd1 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -42,5 +42,6 @@ src.sln - Debug/ - Release/ - -+*.sw* - - cmake_install.cmake -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 512a5bb..d68e943 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -56,22 +56,35 @@ FIND_PACKAGE( Tesseract REQUIRED ) - - include_directories(${Tesseract_INCLUDE_DIRS}) - --# Discover OpenCV directory automatically --find_path(OpenCV_DIR -- NAMES OpenCVConfig.cmake -- HINTS ${CMAKE_SOURCE_DIR}/../libraries/opencv/ --) --# Opencv Package --FIND_PACKAGE( OpenCV REQUIRED ) --IF (${OpenCV_VERSION} VERSION_LESS 2.4.7) -- MESSAGE(FATAL_ERROR "OpenCV version is not compatible : ${OpenCV_VERSION}") -+IF(OpenCV_IOS_FRAMEWORK_PATH) -+ MESSAGE(INFO "Using OpenCV iOS framework: ${OpenCV_IOS_FRAMEWORK_PATH}") -+ -+ # OpenCV's released framework has this disabled, -+ # so we must too. -+ # http://stackoverflow.com/a/32710441/868173 -+ SET(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE NO) -+ -+ SET(OpenCV_INCLUDE_DIRS ${OpenCV_IOS_FRAMEWORK_PATH}/HeadersForAlpr) -+ SET(OpenCV_LIBS ${OpenCV_IOS_FRAMEWORK_PATH}) -+ SET(OpenCV_DIR ${OpenCV_IOS_FRAMEWORK_PATH}/Resources) -+ SET(OpenCV_CONFIG_PATH ${OpenCV_IOS_FRAMEWORK_PATH}/Resources) -+ELSE() -+ # Discover OpenCV directory automatically -+ find_path(OpenCV_DIR -+ NAMES OpenCVConfig.cmake -+ HINTS ${CMAKE_SOURCE_DIR}/../libraries/opencv/ -+ ) -+ # Opencv Package -+ FIND_PACKAGE( OpenCV REQUIRED ) -+ IF (${OpenCV_VERSION} VERSION_LESS 2.4.7) -+ MESSAGE(FATAL_ERROR "OpenCV version is not compatible : ${OpenCV_VERSION}") -+ ENDIF() - ENDIF() - - include_directories(${OpenCV_INCLUDE_DIRS}) - - add_definitions( -DOPENCV_MAJOR_VERSION=${OpenCV_VERSION_MAJOR}) - -- - include_directories(./openalpr ) - - IF (WIN32) -@@ -93,7 +106,10 @@ ENDIF() - - - set(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ") --ADD_EXECUTABLE( alpr main.cpp ) -+ -+if (NOT IOS) -+ ADD_EXECUTABLE( alpr main.cpp ) -+ENDIF() - - if (WIN32) - SET(OPENALPR_LIB openalpr-static) -@@ -101,15 +117,17 @@ ELSE() - SET(OPENALPR_LIB openalpr) - ENDIF() - --TARGET_LINK_LIBRARIES(alpr -- ${OPENALPR_LIB} -- statedetection -- support -+if (NOT IOS) -+ TARGET_LINK_LIBRARIES(alpr -+ ${OPENALPR_LIB} -+ statedetection -+ support - video -- ${OpenCV_LIBS} -- ${Tesseract_LIBRARIES} -+ ${OpenCV_LIBS} -+ ${Tesseract_LIBRARIES} - ${Extra_LIBS} - ) -+ENDIF() - - # Compile the alprd library on Unix-based OS - IF (WITH_DAEMON) -@@ -148,8 +166,10 @@ if (WITH_BINDING_PYTHON) - add_subdirectory(bindings/python) - ENDIF() - --install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) --install (FILES ${CMAKE_SOURCE_DIR}/../doc/man/alpr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 COMPONENT doc) -+if (NOT IOS) -+ install (TARGETS alpr DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -+ install (FILES ${CMAKE_SOURCE_DIR}/../doc/man/alpr.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 COMPONENT doc) -+ENDIF(NOT IOS) - install (DIRECTORY ${CMAKE_SOURCE_DIR}/../runtime_data DESTINATION ${CMAKE_INSTALL_PREFIX}/share/openalpr) - - # set runtime_data to reflect the current CMAKE_INSTALL_PREFIX -diff --git a/src/statedetection/CMakeLists.txt b/src/statedetection/CMakeLists.txt -index a7a3cdb..515798c 100644 ---- a/src/statedetection/CMakeLists.txt -+++ b/src/statedetection/CMakeLists.txt -@@ -8,7 +8,7 @@ set(statedetector_source_files - state_detector_impl.cpp - ) - --if (WIN32) -+if (WIN32 OR IOS) - add_library(statedetection STATIC ${statedetector_source_files} ) - ELSE() - add_library(statedetection SHARED ${statedetector_source_files} ) diff --git a/etc/cmake/Toolchains/iOS.cmake b/etc/cmake/Toolchains/iOS.cmake index e1cd49f..d48e4db 100644 --- a/etc/cmake/Toolchains/iOS.cmake +++ b/etc/cmake/Toolchains/iOS.cmake @@ -193,39 +193,23 @@ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) ################### Start OpenALPR customizations ###################### -# TODO: move to IOS specific block instead of opencv specific # http://stackoverflow.com/questions/822404/how-to-set-up-cmake-to-build-an-app-for-the-iphone # "so that the product type generated would be com.apple.product-type.application instead of com.apple.product-type.tool" set(CMAKE_MACOSX_BUNDLE YES) -#SET(CMAKE_EXE_LINKER_FLAGS "-framework CoreGraphics -framework QuartzCore -framework AssetsLibrary -framework CoreVideo -framework AVFoundation -framework CoreMedia -framework Foundation -framework UIKit -framework ImageIO") -#SET(CMAKE_EXE_LINKER_FLAGS "-framework UIKit -framework ImageIO") - -#FIND_LIBRARY(IMAGE_IO_LIB ImageIO) -#FIND_LIBRARY(UI_KIT_LIB UIKit) -#FIND_LIBRARY(FOUNDATION_LIB Foundation) -#FIND_LIBRARY(AV_FOUNDATION_LIB AVFoundation) -#FIND_LIBRARY(CORE_MEDIA_LIB CoreMedia) -#FIND_LIBRARY(CORE_VIDEO_LIB CoreVideo) -#FIND_LIBRARY(ASSETS_LIB AssetsLibrary) -#FIND_LIBRARY(QUARTZ_CORE_LIB QuartzCore) -#FIND_LIBRARY(CORE_GRAPHICS_LIB CoreGraphics) -#MARK_AS_ADVANCED(CORE_GRAPHICS_LIB) -#SET(Extra_LIBS ${CORE_GRAPHICS_LIB}) - # https://public.kitware.com/Bug/view.php?id=15329 message(STATUS "Disabling code signing for ALPR iOS framework") SET(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) SET(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Don't Code Sign") -SET(CMAKE_INSTALL_PREFIX install) SET(WITH_DAEMON OFF) SET(WITH_UTILITIES OFF) SET(WITH_BINDING_JAVA OFF) SET(WITH_BINDING_PYTHON OFF) -#SET(WITH_GPU_DETECTOR OFF) SET(WITH_TESTS OFF) +SET(CMAKE_INSTALL_PREFIX install) + # These will be unused SET(CMAKE_INSTALL_SYSCONFDIR "etc") SET(CMAKE_INSTALL_VARDIR "var") From 5f1b53770ac4971fd1272a2580e0ca8cfb5714ab Mon Sep 17 00:00:00 2001 From: Alex Porras Date: Wed, 11 Nov 2015 17:30:44 -0500 Subject: [PATCH 02/13] Fix typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e814522..24540d7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A Ruby script that builds an Xcode project and a universal iOS static library fr Running the script will: -- Download the OpenCV 3.0.0 framework binary release and symlink the headers diretory so that the OpenALPR code will see them. +- Download the OpenCV 3.0.0 framework binary release and symlink the headers directory so that the OpenALPR code will see them. - Download and build universal Tesseract 3.03, Leptonica 1.71, and OpenALPR static library framework bundles from source. - Generate a OpenALPR Xcode project From 0c4f79f369f2edc4ccba4a16f039aa44ed424fde Mon Sep 17 00:00:00 2001 From: Alex Porras Date: Wed, 11 Nov 2015 17:31:58 -0500 Subject: [PATCH 03/13] Minor documentation changes --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 24540d7..d245b43 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ Running the script will: - Ruby 2.1.x - [osx-plist](https://github.com/kballard/osx-plist) Ruby gem - Xcode and command line tools. Tested with Xcode 7.1. -- curl (seems to be installed by default on OS X) -- git +- curl, tar, unzip, git (seems to be installed by default on OS X) As of this writing, the latest openalpr commit on the master branch was `eecd41e097534f84e2669da24d4aed4bf75a1132` @@ -34,7 +33,7 @@ As of this writing, the latest openalpr commit on the master branch was `eecd41e ### Bitcode -Because the opencv2 binary release is compiled without bitcode, the other frameworks built by this script are also built without it, which ultimately means your Xcode project also cannot be built with bitcode enabled. [Per this message](http://stackoverflow.com/a/32728516/868173), it sounds like we want this feature disabled for OpenCV anyway. +Because the OpenCV binary framework release is compiled without bitcode, the other frameworks built by this script are also built without it, which ultimately means your Xcode project also cannot be built with bitcode enabled. [Per this message](http://stackoverflow.com/a/32728516/868173), it sounds like we want this feature disabled for OpenCV anyway. To disable bitcode in your project: From 0288bb39001e40bc55e127f18c8f5ed62c2687d2 Mon Sep 17 00:00:00 2001 From: twelve17 Date: Wed, 11 Nov 2015 18:31:29 -0500 Subject: [PATCH 04/13] Also include LIBLEPT_HEADERSDIR. https://github.com/twelve17/openalpr-ios/issues/9 --- lib/alpr/package/tesseract.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/alpr/package/tesseract.rb b/lib/alpr/package/tesseract.rb index 5544b1b..198d601 100644 --- a/lib/alpr/package/tesseract.rb +++ b/lib/alpr/package/tesseract.rb @@ -87,12 +87,15 @@ def extra_libs_dir(target, arch) File.join(self.leptonica_thin_lib_dir, "#{target}-#{arch}") end - # Attempting to use the tesseract "LIBLEPT_HEADERSDIR" + def env_for_arch(target, arch, headers_dir, lib_dir) + super.merge('LIBLEPT_HEADERSDIR' => self.leptonica_headers_dir) + end + + # Attempting to only use the tesseract "LIBLEPT_HEADERSDIR" # was causing the tesseract build fail, as it was setting the # -I flag to $LIBLEPT_HEADERSDIR/leptonica, which is incorrect # (the sources reference lept headers relative to $LIBLEPT_HEADERSDIR) - # It seems that just explicitly including the leptonica headers - # via the -I flag does the trick. + # Looks like also including the headers via the -I flag does the trick. def extra_headers_dir self.leptonica_headers_dir end From 667c5be35c2ed13e0a5988195f69132066cf3c0f Mon Sep 17 00:00:00 2001 From: Jean Azzopardi Date: Thu, 12 Nov 2015 01:51:02 +0100 Subject: [PATCH 05/13] Update README.md Added additional gems that are required by the build script. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d245b43..0db22f1 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,10 @@ Running the script will: ## Requirements - Mac OS X -- Ruby 2.1.x - - [osx-plist](https://github.com/kballard/osx-plist) Ruby gem +- Ruby 2.1.x and the following Gems: + - [osx-plist](https://github.com/kballard/osx-plist) + - [logger](https://rubygems.org/gems/logger/) + - [pry-byebug](https://rubygems.org/gems/pry-byebug) - Xcode and command line tools. Tested with Xcode 7.1. - curl, tar, unzip, git (seems to be installed by default on OS X) From 91c80f6383970bd2b2e76fc5963351df32bb3ab5 Mon Sep 17 00:00:00 2001 From: twelve17 Date: Thu, 12 Nov 2015 11:38:29 -0500 Subject: [PATCH 06/13] remove cmake patching. no longer necessary. --- lib/alpr/package/alpr.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib/alpr/package/alpr.rb b/lib/alpr/package/alpr.rb index 8fbedde..85e9c18 100644 --- a/lib/alpr/package/alpr.rb +++ b/lib/alpr/package/alpr.rb @@ -119,10 +119,6 @@ def build_arch(target, arch) self.merge_libfiles(self.target_libs, self.thin_lib_dir(target, arch), self.target_merged_lib) end - def pre_build_setup - patch_cmakelists - end - def post_build_setup install_resources end @@ -173,17 +169,5 @@ def cmake_build_dir File.join(cmake_src_dir, 'build') end - def patch_cmakelists - logger.info("patching CMakeLists") - common_args = "-d #{self.package_dir} -p1 -i #{CONFIG_DIR}/cmake/OpenALPR_CMakeLists.txt.patch" - output = `patch --silent --dry-run #{common_args}` - # file is not patched yet - if $?.success? - log_execute("patch #{common_args}") - else - logger.info("CMakeLists is already patched") # TODO: could be error too - end - end - end end From b378a89c5a18c49d2955f9d5422a46b6ad1d5bcf Mon Sep 17 00:00:00 2001 From: twelve17 Date: Thu, 12 Nov 2015 11:38:58 -0500 Subject: [PATCH 07/13] Use bundler for dependencies. Small documentation changes. --- Gemfile | 4 ++++ Gemfile.lock | 27 +++++++++++++++++++++++++++ README.md | 10 ++++++---- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..60ea8b6 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' +gem 'osx-plist', '~> 1.0' +gem 'logger', '~> 1.2' +gem 'pry-byebug', '~> 3.3' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..00b36c2 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,27 @@ +GEM + remote: https://rubygems.org/ + specs: + byebug (8.2.0) + coderay (1.1.0) + logger (1.2.8) + method_source (0.8.2) + osx-plist (1.0.3) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-byebug (3.3.0) + byebug (~> 8.0) + pry (~> 0.10) + slop (3.6.0) + +PLATFORMS + ruby + +DEPENDENCIES + logger (~> 1.2) + osx-plist (~> 1.0) + pry-byebug (~> 3.3) + +BUNDLED WITH + 1.10.6 diff --git a/README.md b/README.md index 0db22f1..8cf6180 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Running the script will: ## Requirements - Mac OS X -- Ruby 2.1.x and the following Gems: +- Ruby 2.1.x and the following Gems (provided by bundler): - [osx-plist](https://github.com/kballard/osx-plist) - [logger](https://rubygems.org/gems/logger/) - [pry-byebug](https://rubygems.org/gems/pry-byebug) @@ -29,7 +29,8 @@ As of this writing, the latest openalpr commit on the master branch was `eecd41e # git clone git@github.com:twelve17/openalpr-ios.git ``` -- Run the `./bin/build_frameworks.rb` script. By default, it will put all the frameworks under a subdirectory called `output`. You can pass an alternate path with the `-d` option. Intermediate files are kept under the `work` subdirectory, including a log called `build.log` which you can inspect for errors. +- Install dependencies: `bundle install` +- Run `bundle exec ./bin/build_frameworks.rb`. By default, it will put all the frameworks under a subdirectory called `output`. You can pass an alternate path with the `-d` option. Intermediate files are kept under the `work` subdirectory, including a log called `build.log` which you can inspect for errors. ## Usage @@ -52,13 +53,14 @@ To disable bitcode in your project: ## AlprSample App -You can use the `AlprSample` app included in this project to test your installation. It has one view that simply presents a fixed (pre-selected) license place image, and a table view below it showing scanned plate values for that image. +You can use the `AlprSample` app included in this project to test your installation. It has one view that simply presents a fixed (pre-selected) license plate image, and a table view below it showing scanned plate values for that image. To run the app, you will need to build the frameworks with `build_frameworks.rb`. Then, in Xcode, open the project and follow these steps: 1. Find a plate image file you wish to test with and add it to the project. 2. Edit `ViewController.mm` and change the value of `plateFilename` to the name of the file you added in step 1, e.g. `NSString *plateFilename = @"license_plate.jpg";` 3. Link the project to the dependency frameworks and add the required resources per the "Linking To Frameworks" section above. +4. Run the app! The library should work in a simulator. ## Misc Notes @@ -82,7 +84,7 @@ Steps for creating the app are kept here for posterity. - [Viewing iOS device logs](http://stackoverflow.com/a/31379741/868173) - Viewing symbols in library: `nm -gUj openalpr.framework/Libraries/libopenalpr-static.a | c++filt` -- [Seeing errors in Simulator](http://stackoverflow.com/a/26129829/868173): +- [Inspecting the Simulator logs](http://stackoverflow.com/a/26129829/868173): `tail -f ~/Library/Logs/CoreSimulator/*.log` - clean up temporary Xcode items From d34ad39acb47452a9092a6d4742c40e2df52c093 Mon Sep 17 00:00:00 2001 From: Alex Porras Date: Thu, 12 Nov 2015 11:41:32 -0500 Subject: [PATCH 08/13] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 8cf6180..59a6541 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,7 @@ Running the script will: ## Requirements - Mac OS X -- Ruby 2.1.x and the following Gems (provided by bundler): - - [osx-plist](https://github.com/kballard/osx-plist) - - [logger](https://rubygems.org/gems/logger/) - - [pry-byebug](https://rubygems.org/gems/pry-byebug) +- Ruby 2.1.x, bundler - Xcode and command line tools. Tested with Xcode 7.1. - curl, tar, unzip, git (seems to be installed by default on OS X) From a0e80210205dbd833fd1a5e6f2a63b06de84db72 Mon Sep 17 00:00:00 2001 From: twelve17 Date: Thu, 12 Nov 2015 11:42:23 -0500 Subject: [PATCH 09/13] Remove pry-byebug dependency. --- Gemfile | 2 +- Gemfile.lock | 12 ------------ bin/build_frameworks.rb | 1 - 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 60ea8b6..b8c75b4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' gem 'osx-plist', '~> 1.0' gem 'logger', '~> 1.2' -gem 'pry-byebug', '~> 3.3' +#gem 'pry-byebug', '~> 3.3' diff --git a/Gemfile.lock b/Gemfile.lock index 00b36c2..43c7397 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,19 +1,8 @@ GEM remote: https://rubygems.org/ specs: - byebug (8.2.0) - coderay (1.1.0) logger (1.2.8) - method_source (0.8.2) osx-plist (1.0.3) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-byebug (3.3.0) - byebug (~> 8.0) - pry (~> 0.10) - slop (3.6.0) PLATFORMS ruby @@ -21,7 +10,6 @@ PLATFORMS DEPENDENCIES logger (~> 1.2) osx-plist (~> 1.0) - pry-byebug (~> 3.3) BUNDLED WITH 1.10.6 diff --git a/bin/build_frameworks.rb b/bin/build_frameworks.rb index 33c42e9..9f49e61 100755 --- a/bin/build_frameworks.rb +++ b/bin/build_frameworks.rb @@ -2,7 +2,6 @@ # Tested on Ruby 2.1.2 -require 'pry-byebug' require 'optparse' require 'logger' require_relative '../lib/alpr/package' From 093c6109c3c6a9864a627a7efa9c32651db55303 Mon Sep 17 00:00:00 2001 From: Alex Porras Date: Mon, 30 Nov 2015 15:07:21 -0500 Subject: [PATCH 10/13] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 59a6541..42e3e8e 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ As of this writing, the latest openalpr commit on the master branch was `eecd41e ``` - Install dependencies: `bundle install` +- If running Homebrew, unlink existing installs of leptonica and tesseract, as the OpenALPR library will use those instead, which we don't want: `brew unlink leptonica tesseract`. You can run `brew link` to re-link them after the install is done. - Run `bundle exec ./bin/build_frameworks.rb`. By default, it will put all the frameworks under a subdirectory called `output`. You can pass an alternate path with the `-d` option. Intermediate files are kept under the `work` subdirectory, including a log called `build.log` which you can inspect for errors. ## Usage From da661f12e3bc64005afffc0fdac60aaf5fbf5b9a Mon Sep 17 00:00:00 2001 From: Bogdan Vitoc Date: Mon, 7 Dec 2015 11:17:04 -0500 Subject: [PATCH 11/13] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 42e3e8e..f117398 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Running the script will: - Ruby 2.1.x, bundler - Xcode and command line tools. Tested with Xcode 7.1. - curl, tar, unzip, git (seems to be installed by default on OS X) +- cmake (links: homebrew | source) As of this writing, the latest openalpr commit on the master branch was `eecd41e097534f84e2669da24d4aed4bf75a1132` From c297199a9c19e22374015bbb3289e53542df395c Mon Sep 17 00:00:00 2001 From: twelve17 Date: Wed, 9 Dec 2015 10:12:33 -0500 Subject: [PATCH 12/13] Check Ruby version, as people are not RTFM. Check existence of autoconf and cmake. --- bin/build_frameworks.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bin/build_frameworks.rb b/bin/build_frameworks.rb index 9f49e61..35ea656 100755 --- a/bin/build_frameworks.rb +++ b/bin/build_frameworks.rb @@ -2,6 +2,29 @@ # Tested on Ruby 2.1.2 +#----------------------------------------------------------------------------- +# Check ruby version before requiring alpr libs, which use 2.1.x named params. +#----------------------------------------------------------------------------- +def ruby_version_new_enough? + ruby_v = RUBY_VERSION.split('.').map(&:to_i) + ruby_v[0] >= 2 && ruby_v[1] >= 1 +end + +def check_deps + if !ruby_version_new_enough? + raise "Ruby 2.1.x or later is required. You have: #{RUBY_VERSION}." + end + %w{cmake autoconf}.each do |prog| + `which -s #{prog}` + unless $?.success? + raise "Dependency '#{prog}' is missing. Please install it and try again. See the README.md for details." + end + end +end + +check_deps +#----------------------------------------------------------------------------- + require 'optparse' require 'logger' require_relative '../lib/alpr/package' From 7e8040b81c007fe9af8558a5bd3d211f93ac9776 Mon Sep 17 00:00:00 2001 From: twelve17 Date: Wed, 9 Dec 2015 10:12:48 -0500 Subject: [PATCH 13/13] add autoconf requirement --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f117398..b6ecae6 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ Running the script will: ## Requirements - Mac OS X -- Ruby 2.1.x, bundler +- Ruby *2.1*.x, bundler - Xcode and command line tools. Tested with Xcode 7.1. - curl, tar, unzip, git (seems to be installed by default on OS X) -- cmake (links: homebrew | source) +- cmake (homebrew | source) +- autoconf (homebrew | source) As of this writing, the latest openalpr commit on the master branch was `eecd41e097534f84e2669da24d4aed4bf75a1132`