diff --git a/libs/openFrameworks/types/ofBaseTypes.h b/libs/openFrameworks/types/ofBaseTypes.h index b3f779b4698..cfd7cd5cb46 100644 --- a/libs/openFrameworks/types/ofBaseTypes.h +++ b/libs/openFrameworks/types/ofBaseTypes.h @@ -60,223 +60,362 @@ class ofBaseDraws{ virtual void draw(const ofPoint & point, float w, float h) const { draw(point.x, point.y, w, h); } - + virtual float getHeight() const = 0; virtual float getWidth() const = 0; - + virtual void setAnchorPercent(float xPct, float yPct){}; virtual void setAnchorPoint(float x, float y){}; virtual void resetAnchor(){}; - -}; -//---------------------------------------------------------- -// ofBaseUpdates -//---------------------------------------------------------- +}; +/// \brief An abstract class representing an object that can be updated. class ofBaseUpdates{ public: + /// \brief Destroy the ofBaseUpdates. virtual ~ofBaseUpdates(){} + + /// \brief Update the object's state. virtual void update()=0; }; -//---------------------------------------------------------- -// ofBaseHasTexture -//---------------------------------------------------------- class ofTexture; + +/// \brief An abstract class representing an object that can have an ofTexture. class ofBaseHasTexture{ public: + /// \brief Destroy the ofBaseHasTexture. virtual ~ofBaseHasTexture(){} + + /// \returns a reference to the ofTexture. virtual ofTexture & getTexture()=0; + + /// \returns a const reference to the ofTexture. virtual const ofTexture & getTexture() const=0; + + /// \brief Enable or disable internal ofTexture use. + /// \param bUseTex true if an ofTexture should be used. virtual void setUseTexture(bool bUseTex)=0; + + /// \returns true if an internal ofTexture is being used. virtual bool isUsingTexture() const=0; }; + +/// \brief An abstract class representing an object that ofTexture planes. class ofBaseHasTexturePlanes: public ofBaseHasTexture{ public: + /// \brief Destroy the ofBaseHasTexturePlanes. virtual ~ofBaseHasTexturePlanes(){} + + /// \returns a reference to a std::vector containing the ofTexture planes. virtual vector & getTexturePlanes()=0; + + /// \returns a const reference to a std::vector containing the ofTexture planes. virtual const vector & getTexturePlanes() const=0; }; -//---------------------------------------------------------- -// ofAbstractHasPixels -//---------------------------------------------------------- + +/// \brief An abstract class representing an object that has pixels. +/// +/// This empty class primarily exists to allow templated subclasses of different +/// types to be stored as raw or shared pointers in collections such as +/// std::vector. +/// +/// Example: +/// \code{.cpp} +/// +/// std::vector pixelProviders; +/// +/// ofPixels pixels; +/// ofFloatPixels floatPixels; +/// ofShortPixels shortPixels; +/// +/// // ... +/// +/// pixelProviders.push_back(&pixels); +/// pixelProviders.push_back(&floatPixels); +/// pixelProviders.push_back(&shortPixels); +/// +/// \endcode class ofAbstractHasPixels{ public: + /// \brief Destroy the ofAbstractHasPixels. virtual ~ofAbstractHasPixels(){} }; -//---------------------------------------------------------- -// ofBaseHasPixels -//---------------------------------------------------------- + +/// \brief A base class represeting an object that has pixels. +/// \tparam T The pixel data type. template class ofBaseHasPixels_: public ofAbstractHasPixels{ public: + /// \brief Destroy the ofAbstractHasPixels. virtual ~ofBaseHasPixels_(){} + + /// \brief Get a reference to the underlying ofPixels. + /// \returns a reference the underlying ofPixels. virtual ofPixels_ & getPixels()=0; + + /// \brief Get a const reference to the underlying ofPixels. + /// \returns a const reference the underlying ofPixels. virtual const ofPixels_ & getPixels() const=0; }; +/// \brief A typedef for an unsigned char ofBaseHasPixels_. typedef ofBaseHasPixels_ ofBaseHasPixels; + +/// \brief A typedef for an float ofBaseHasPixels_. typedef ofBaseHasPixels_ ofBaseHasFloatPixels; + +/// \brief A typedef for an unsigned short ofBaseHasPixels_. typedef ofBaseHasPixels_ ofBaseHasShortPixels; -//---------------------------------------------------------- -// ofAbstractImage -> to be able to put different types of images in vectors... -//---------------------------------------------------------- + +/// \brief An abstract class representing an image. +/// +/// This empty class primarily exists to allow templated subclasses of different +/// types to be stored as raw or shared pointers in collections such as +/// std::vector. +/// +/// Example: +/// \code{.cpp} +/// +/// std::vector imageProviders; +/// +/// ofImage image; +/// ofFloatImage floatImage; +/// ofShortImage shortImage; +/// +/// // ... +/// +/// imageProviders.push_back(&image); +/// imageProviders.push_back(&floatImage); +/// imageProviders.push_back(&shortImage); +/// +/// \endcode class ofAbstractImage: public ofBaseDraws, public ofBaseHasTexture{ public: + /// \brief Destroy the ofAbstractImage. virtual ~ofAbstractImage(){} }; -//---------------------------------------------------------- -// ofBaseImage -//---------------------------------------------------------- +/// \brief A base class represeting an image. +/// \tparam T The pixel data type. template class ofBaseImage_: public ofAbstractImage, virtual public ofBaseHasPixels_{ public: + /// \brief Destroy the ofBaseImage_. virtual ~ofBaseImage_(){}; }; + +/// \brief A typedef for an unsigned char ofBaseImage_. typedef ofBaseImage_ ofBaseImage; + +/// \brief A typedef for an float ofBaseImage_. typedef ofBaseImage_ ofBaseFloatImage; + +/// \brief A typedef for an unsigned short ofBaseImage_. typedef ofBaseImage_ ofBaseShortImage; -//---------------------------------------------------------- -// ofBaseHasSoundStream -//---------------------------------------------------------- + + +/// \brief A base class representing a sound input stream. class ofBaseSoundInput{ +public: + /// \brief Destroy the ofBaseSoundInput. + virtual ~ofBaseSoundInput() {}; - public: - virtual ~ofBaseSoundInput() {}; - - virtual void audioIn( float * input, int bufferSize, int nChannels, int deviceID, long unsigned long tickCount ){ - audioIn(input, bufferSize, nChannels); - } + /// \todo + virtual void audioIn( float * input, int bufferSize, int nChannels, int deviceID, long unsigned long tickCount ){ + audioIn(input, bufferSize, nChannels); + } - virtual void audioIn( float * input, int bufferSize, int nChannels ){ - audioReceived(input, bufferSize, nChannels); - } + /// \todo + virtual void audioIn( float * input, int bufferSize, int nChannels ){ + audioReceived(input, bufferSize, nChannels); + } - virtual void audioReceived( float * input, int bufferSize, int nChannels ){} + /// \todo + virtual void audioReceived( float * input, int bufferSize, int nChannels ){} }; -//---------------------------------------------------------- -// ofBaseHasSoundStream -//---------------------------------------------------------- + +/// \brief A base class representing a sound output stream. class ofBaseSoundOutput{ +public: + /// \brief Destroy the ofBaseSoundOutput. + virtual ~ofBaseSoundOutput() {}; - public: - virtual ~ofBaseSoundOutput() {}; - - virtual void audioOut( float * output, int bufferSize, int nChannels, int deviceID, long unsigned long tickCount ){ - audioOut(output, bufferSize, nChannels); - } + /// \todo + virtual void audioOut( float * output, int bufferSize, int nChannels, int deviceID, long unsigned long tickCount ){ + audioOut(output, bufferSize, nChannels); + } - virtual void audioOut( float * output, int bufferSize, int nChannels ){ - audioRequested(output, bufferSize, nChannels); - } + /// \todo + virtual void audioOut( float * output, int bufferSize, int nChannels ){ + audioRequested(output, bufferSize, nChannels); + } - //legacy - virtual void audioRequested( float * output, int bufferSize, int nChannels ){ - } + /// \todo + /// \note This is a legacy method. + virtual void audioRequested( float * output, int bufferSize, int nChannels ){ + } }; -//---------------------------------------------------------- -// ofBaseVideo -//---------------------------------------------------------- +/// \brief A base class representing a video source. class ofBaseVideo: virtual public ofBaseHasPixels, public ofBaseUpdates{ public: + /// \brief Destroy the ofBaseVideo. virtual ~ofBaseVideo(){} + + /// \returns true if the pixel data was updated since the last call to update(). virtual bool isFrameNew() const =0; + + /// \brief Close the video source. virtual void close()=0; + + /// \brief Determine if the video source is initialized. + /// + /// Video sources such as cameras are often initialized with a + /// setup() method. Video sources such as movie players are often + /// initialized with a load() method. + /// + /// \returns true if the video source is initialized. virtual bool isInitialized() const=0; + /// \brief Set the requested ofPixelFormat. + /// \param pixelFormat the requested ofPixelFormat. + /// \returns true if the format was successfully changed. virtual bool setPixelFormat(ofPixelFormat pixelFormat) = 0; + + /// \returns the current ofPixelFormat. virtual ofPixelFormat getPixelFormat() const = 0; }; -//---------------------------------------------------------- -// ofBaseVideoDraws -//---------------------------------------------------------- -class ofBaseVideoDraws: virtual public ofBaseVideo, public ofBaseDraws, public ofBaseHasTexturePlanes,virtual public ofBaseHasPixels{ +/// \brief A base class representing a drawable video source. +class ofBaseVideoDraws: + virtual public ofBaseVideo, + public ofBaseDraws, + public ofBaseHasTexturePlanes, + virtual public ofBaseHasPixels{ public: + /// \brief Destroy the ofBaseVideoDraws. virtual ~ofBaseVideoDraws(){} }; -//---------------------------------------------------------- -// ofBaseVideoGrabber -//---------------------------------------------------------- +/// \brief A base class representing a video device such as a camera. class ofBaseVideoGrabber: virtual public ofBaseVideo{ - + public : + /// \brief Destroy the ofBaseVideoGrabber virtual ~ofBaseVideoGrabber(); //needs implementing + /// \brief Get a list of available video grabber devices. + /// \returns a std::vector of ofVideoDevice objects. virtual vector listDevices() const = 0; - virtual bool setup(int w, int h) = 0; - - virtual float getHeight() const = 0; - virtual float getWidth() const = 0; - // implement only if internal API can upload directly to texture + /// \brief Set up the grabber with the requested width and height. + /// + /// Some video grabbers may take the requested width and height as + /// a hint and choose the closest dimensions to those requested. + /// Users can check the actual width and height by calling getWidth() and + /// getHeight() respectively after a successful setup. + /// + /// \param w the requested width. + /// \param h the requested height. + /// \returns true if the video grabber was set up successfully. + virtual bool setup(int w, int h) = 0; + + /// \brief Get the video grabber's height. + /// \returns the video grabber's height. + virtual float getHeight() const = 0; + + /// \brief Get the video grabber's width. + /// \returns the video grabber's width. + virtual float getWidth() const = 0; + + /// \brief Get the video grabber's internal ofTexture pointer if available. + /// + /// \note Subclasses should implement this method only if internal API can + /// upload video grabber pixels directly to an ofTexture. + /// + /// \returns the internal ofTexture pointer or NULL if not available. virtual ofTexture * getTexturePtr(){ return NULL; } - //should implement! + /// \brief Set the video grabber's hardware verbosity level. + /// \param bTalkToMe true if verbose grabber logging feedback is required. virtual void setVerbose(bool bTalkToMe); - virtual void setDeviceID(int _deviceID); + + /// \brief Set the video grabber's device ID. + /// + /// In most cases, a user can choose a specific grabber source by ID. This + /// device ID information should be available to the user via the + /// listDevices() method. + /// + /// \param deviceID The device ID provided by listDevices(). + virtual void setDeviceID(int deviceID); + + /// \brief Set the video grabber's desired frame rate. + /// + /// Many video grabbers support user-specified frame rates. This frame rate + /// should be considered a hint for the video grabber and is not guaranteed. + /// + /// \param framerate the desired frame rate. virtual void setDesiredFrameRate(int framerate); + + /// \brief Request a native GUI for video grabber settings. + /// \note This feature may not be implemented by all video grabbers. virtual void videoSettings(); - + }; -//---------------------------------------------------------- -// ofBaseVideoPlayer -//---------------------------------------------------------- +/// \brief A base class representing a video player. class ofBaseVideoPlayer: virtual public ofBaseVideo{ - + public: virtual ~ofBaseVideoPlayer(); - + //needs implementing virtual bool load(string name) = 0; - + virtual void play() = 0; - virtual void stop() = 0; + virtual void stop() = 0; virtual ofTexture * getTexturePtr(){return NULL;}; // if your videoplayer needs to implement seperate texture and pixel returns for performance, implement this function to return a texture instead of a pixel array. see iPhoneVideoGrabber for reference - + virtual float getWidth() const = 0; virtual float getHeight() const = 0; - + virtual bool isPaused() const = 0; virtual bool isLoaded() const = 0; virtual bool isPlaying() const = 0; virtual bool isInitialized() const{ return isLoaded(); } - + //should implement! virtual float getPosition() const; virtual float getSpeed() const; virtual float getDuration() const; virtual bool getIsMovieDone() const; - + virtual void setPaused(bool bPause); virtual void setPosition(float pct); virtual void setVolume(float volume); // 0..1 virtual void setLoopState(ofLoopType state); virtual void setSpeed(float speed); virtual void setFrame(int frame); // frame 0 = first frame... - + virtual int getCurrentFrame() const; virtual int getTotalNumFrames() const; virtual ofLoopType getLoopState() const; - + virtual void firstFrame(); virtual void nextFrame(); virtual void previousFrame(); @@ -304,7 +443,7 @@ class ofBaseRenderer{ } virtual void draw(const ofMesh & vertexData, bool useColors, bool useTextures, bool useNormals) const=0; virtual void draw(const ofMesh & vertexData, ofPolyRenderMode renderType, bool useColors, bool useTextures, bool useNormals) const=0; - virtual void draw(const of3dPrimitive& model, ofPolyRenderMode renderType) const=0; + virtual void draw(const of3dPrimitive& model, ofPolyRenderMode renderType) const=0; virtual void draw(const ofImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const=0; virtual void draw(const ofFloatImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const=0; virtual void draw(const ofShortImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const=0; @@ -358,7 +497,7 @@ class ofBaseRenderer{ virtual void multViewMatrix(const ofMatrix4x4 & m)=0; virtual ofMatrix4x4 getCurrentViewMatrix() const=0; virtual ofMatrix4x4 getCurrentNormalMatrix() const=0; - + // screen coordinate things / default gl values virtual void setupGraphicDefaults()=0; virtual void setupScreen()=0; @@ -467,13 +606,13 @@ class ofBaseFileSerializer: public ofBaseSerializer{ class ofBaseURLFileLoader{ public: virtual ~ofBaseURLFileLoader(){}; - virtual ofHttpResponse get(string url)=0; - virtual int getAsync(string url, string name="")=0; - virtual ofHttpResponse saveTo(string url, string path)=0; - virtual int saveAsync(string url, string path)=0; - virtual void remove(int id)=0; - virtual void clear()=0; - virtual void stop()=0; + virtual ofHttpResponse get(string url)=0; + virtual int getAsync(string url, string name="")=0; + virtual ofHttpResponse saveTo(string url, string path)=0; + virtual int saveAsync(string url, string path)=0; + virtual void remove(int id)=0; + virtual void clear()=0; + virtual void stop()=0; }; class ofBaseMaterial{ diff --git a/libs/openFrameworks/utils/ofConstants.h b/libs/openFrameworks/utils/ofConstants.h index 21c8a902432..f69b3f70da2 100644 --- a/libs/openFrameworks/utils/ofConstants.h +++ b/libs/openFrameworks/utils/ofConstants.h @@ -59,7 +59,8 @@ enum ofTargetPlatform{ #if defined( __WIN32__ ) || defined( _WIN32 ) #define TARGET_WIN32 #elif defined( __APPLE_CC__) - #include + #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 + #include #if (TARGET_OS_IPHONE_SIMULATOR) || (TARGET_OS_IPHONE) || (TARGET_IPHONE) #define TARGET_OF_IPHONE diff --git a/scripts/apothecary/formulas/openssl.sh b/scripts/apothecary/formulas/openssl.sh index e900288fdc2..d2f39499916 100644 --- a/scripts/apothecary/formulas/openssl.sh +++ b/scripts/apothecary/formulas/openssl.sh @@ -507,20 +507,18 @@ function copy() { # storing a copy of the include in lib/include/ # set via: cp -R "build/$TYPE/x86_64/include/" "lib/include/" - rm -r $1/lib/$TYPE/* + # suppress file not found errors + rm -rf $1/lib/$TYPE/* 2> /dev/null # libs - if [ "$TYPE" == "osx" ] ; then - echoWarning "TODO: copy $TYPE lib" - # mkdir -p $1/lib/$TYPE - # cp -v lib/Darwin/*.a $1/lib/$TYPE + if [ "$TYPE" == "osx" ] ; then + cp -Rv lib/include/ $1/include/ + mkdir -p $1/lib/$TYPE + cp -v lib/$TYPE/*.a $1/lib/$TYPE elif [ "$TYPE" == "ios" ] ; then cp -Rv lib/include/ $1/include/ mkdir -p $1/lib/$TYPE cp -v lib/$TYPE/*.a $1/lib/$TYPE - elif [ "$TYPE" == "osx" ] ; then - mkdir -p $1/lib/$TYPE - cp -v lib/$TYPE/*.a $1/lib/$TYPE # elif [ "$TYPE" == "vs" ] ; then # mkdir -p $1/lib/$TYPE # cp -v lib/*.lib $1/lib/$TYPE diff --git a/scripts/apothecary/formulas/poco/components.patch b/scripts/apothecary/formulas/poco/components.patch new file mode 100644 index 00000000000..d5f6736f998 --- /dev/null +++ b/scripts/apothecary/formulas/poco/components.patch @@ -0,0 +1,22 @@ +--- components Mon Aug 18 21:40:47 2014 ++++ components Mon Aug 18 21:39:51 2014 +@@ -1,5 +1,3 @@ +-CppUnit +-CppUnit/WinTestRunner + Foundation + XML + JSON +@@ -9,13 +7,6 @@ + NetSSL_OpenSSL + Data + Data/SQLite +-Data/ODBC +-Data/MySQL + Zip +-PageCompiler +-PageCompiler/File2Page + PDF +-CppParser + MongoDB +-PocoDoc +-ProGen diff --git a/scripts/apothecary/formulas/poco/poco.headers.patch b/scripts/apothecary/formulas/poco/poco.headers.patch deleted file mode 100644 index 00c0ee0e60a..00000000000 --- a/scripts/apothecary/formulas/poco/poco.headers.patch +++ /dev/null @@ -1,984 +0,0 @@ -Only in work-Poco/: .DS_Store -diff -ru Poco/AbstractDelegate.h work-Poco/AbstractDelegate.h ---- Poco/AbstractDelegate.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/AbstractDelegate.h 2013-09-26 16:00:50.000000000 +0100 -@@ -85,6 +85,44 @@ - } - }; - -+template <> -+class AbstractDelegate -+ /// Base class for Delegate and Expire. -+{ -+public: -+ AbstractDelegate() -+ { -+ } -+ -+ AbstractDelegate(const AbstractDelegate& del) -+ { -+ } -+ -+ virtual ~AbstractDelegate() -+ { -+ } -+ -+ virtual bool notify(const void* sender) = 0; -+ /// Invokes the delegate's callback function. -+ /// Returns true if successful, or false if the delegate -+ /// has been disabled or has expired. -+ -+ virtual bool equals(const AbstractDelegate& other) const = 0; -+ /// Compares the AbstractDelegate with the other one for equality. -+ -+ virtual AbstractDelegate* clone() const = 0; -+ /// Returns a deep copy of the AbstractDelegate. -+ -+ virtual void disable() = 0; -+ /// Disables the delegate, which is done prior to removal. -+ -+ virtual const AbstractDelegate* unwrap() const -+ /// Returns the unwrapped delegate. Must be overridden by decorators -+ /// like Expire. -+ { -+ return this; -+ } -+}; - - } // namespace Poco - -diff -ru Poco/AbstractEvent.h work-Poco/AbstractEvent.h ---- Poco/AbstractEvent.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/AbstractEvent.h 2013-09-26 16:06:19.000000000 +0100 -@@ -346,6 +346,296 @@ - AbstractEvent& operator = (const AbstractEvent& other); - }; - -+template -+class AbstractEvent -+ /// An AbstractEvent is the base class of all events. -+ /// It works similar to the way C# handles notifications (aka events in C#). -+ /// -+ /// Events can be used to send information to a set of delegates -+ /// which are registered with the event. The type of the data is specified with -+ /// the template parameter TArgs. The TStrategy parameter must be a subclass -+ /// of NotificationStrategy. The parameter TDelegate can either be a subclass of AbstractDelegate -+ /// or of AbstractPriorityDelegate. -+ /// -+ /// Note that AbstractEvent should never be used directly. One ought to use -+ /// one of its subclasses which set the TStrategy and TDelegate template parameters -+ /// to fixed values. For most use-cases the BasicEvent template will be sufficient: -+ /// -+ /// #include "Poco/BasicEvent.h" -+ /// #include "Poco/Delegate.h" -+ /// -+ /// Note that as of release 1.4.2, the behavior of BasicEvent equals that of FIFOEvent, -+ /// so the FIFOEvent class is no longer necessary and provided for backwards compatibility -+ /// only. -+ /// -+ /// BasicEvent works with a standard delegate. They allow one object to register -+ /// onr or more delegates with an event. In contrast, a PriorityDelegate comes with an attached priority value -+ /// and allows one object to register for one priority value one or more delegates. Note that PriorityDelegates -+ /// only work with PriorityEvents: -+ /// -+ /// #include "Poco/PriorityEvent.h" -+ /// #include "Poco/PriorityDelegate.h" -+ /// -+ /// Use events by adding them as public members to the object which is throwing notifications: -+ /// -+ /// class MyData -+ /// { -+ /// public: -+ /// Poco::BasicEvent dataChanged; -+ /// -+ /// MyData(); -+ /// ... -+ /// void setData(int i); -+ /// ... -+ /// private: -+ /// int _data; -+ /// }; -+ /// -+ /// Firing the event is done either by calling the event's notify() or notifyAsync() method: -+ /// -+ /// void MyData::setData(int i) -+ /// { -+ /// this->_data = i; -+ /// dataChanged.notify(this, this->_data); -+ /// } -+ /// -+ /// Alternatively, instead of notify(), operator () can be used. -+ /// -+ /// void MyData::setData(int i) -+ /// { -+ /// this->_data = i; -+ /// dataChanged(this, this->_data); -+ /// } -+ /// -+ /// Note that operator (), notify() and notifyAsync() do not catch exceptions, i.e. in case a -+ /// delegate throws an exception, notifying is immediately aborted and the exception is propagated -+ /// back to the caller. -+ /// -+ /// Delegates can register methods at the event. In the case of a BasicEvent -+ /// the Delegate template is used, in case of an PriorityEvent a PriorityDelegate is used. -+ /// Mixing of delegates, e.g. using a PriorityDelegate with a BasicEvent is not allowed and -+ /// can lead to compile-time and/or run-time errors. The standalone delegate() functions -+ /// can be used to construct Delegate objects. -+ /// -+ /// Events require the observers to have one of the following method signatures: -+ /// -+ /// void onEvent(const void* pSender, TArgs& args); -+ /// void onEvent(TArgs& args); -+ /// static void onEvent(const void* pSender, TArgs& args); -+ /// static void onEvent(void* pSender, TArgs& args); -+ /// static void onEvent(TArgs& args); -+ /// -+ /// For performance reasons arguments are always sent by reference. This also allows observers -+ /// to modify the event argument. To prevent that, use <[const TArg]> as template -+ /// parameter. A non-conformant method signature leads to compile errors. -+ /// -+ /// Assuming that the observer meets the method signature requirement, it can register -+ /// this method with the += operator: -+ /// -+ /// class MyController -+ /// { -+ /// protected: -+ /// MyData _data; -+ /// -+ /// void onDataChanged(void* pSender, int& data); -+ /// ... -+ /// }; -+ /// -+ /// MyController::MyController() -+ /// { -+ /// _data.dataChanged += delegate(this, &MyController::onDataChanged); -+ /// } -+ /// -+ /// In some cases it might be desirable to work with automatically expiring registrations. Simply add -+ /// to delegate as 3rd parameter a expireValue (in milliseconds): -+ /// -+ /// _data.dataChanged += delegate(this, &MyController::onDataChanged, 1000); -+ /// -+ /// This will add a delegate to the event which will automatically be removed in 1000 millisecs. -+ /// -+ /// Unregistering happens via the -= operator. Forgetting to unregister a method will lead to -+ /// segmentation faults later, when one tries to send a notify to a no longer existing object. -+ /// -+ /// MyController::~MyController() -+ /// { -+ /// _data.dataChanged -= delegate(this, &MyController::onDataChanged); -+ /// } -+ /// -+ /// Working with PriorityDelegate's as similar to working with BasicEvent. -+ /// Instead of delegate(), the priorityDelegate() function must be used -+ /// to create the PriorityDelegate. -+{ -+public: -+ AbstractEvent(): -+ _executeAsync(this, &AbstractEvent::executeAsyncImpl), -+ _enabled(true) -+ { -+ } -+ -+ AbstractEvent(const TStrategy& strat): -+ _executeAsync(this, &AbstractEvent::executeAsyncImpl), -+ _strategy(strat), -+ _enabled(true) -+ { -+ } -+ -+ virtual ~AbstractEvent() -+ { -+ } -+ -+ void operator += (const TDelegate& aDelegate) -+ /// Adds a delegate to the event. -+ /// -+ /// Exact behavior is determined by the TStrategy. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ _strategy.add(aDelegate); -+ } -+ -+ void operator -= (const TDelegate& aDelegate) -+ /// Removes a delegate from the event. -+ /// -+ /// If the delegate is not found, this function does nothing. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ _strategy.remove(aDelegate); -+ } -+ -+ void operator () (const void* pSender) -+ /// Shortcut for notify(pSender, args); -+ { -+ notify(pSender); -+ } -+ -+ void operator () () -+ /// Shortcut for notify(args). -+ { -+ notify(0); -+ } -+ -+ void notify(const void* pSender) -+ /// Sends a notification to all registered delegates. The order is -+ /// determined by the TStrategy. This method is blocking. While executing, -+ /// the list of delegates may be modified. These changes don't -+ /// influence the current active notifications but are activated with -+ /// the next notify. If a delegate is removed during a notify(), the -+ /// delegate will no longer be invoked (unless it has already been -+ /// invoked prior to removal). If one of the delegates throws an exception, -+ /// the notify method is immediately aborted and the exception is propagated -+ /// to the caller. -+ { -+ Poco::ScopedLockWithUnlock lock(_mutex); -+ -+ if (!_enabled) return; -+ -+ // thread-safeness: -+ // copy should be faster and safer than blocking until -+ // execution ends -+ TStrategy strategy(_strategy); -+ lock.unlock(); -+ strategy.notify(pSender); -+ } -+ -+ ActiveResult notifyAsync(const void* pSender) -+ /// Sends a notification to all registered delegates. The order is -+ /// determined by the TStrategy. This method is not blocking and will -+ /// immediately return. The delegates are invoked in a seperate thread. -+ /// Call activeResult.wait() to wait until the notification has ended. -+ /// While executing, other objects can change the delegate list. These changes don't -+ /// influence the current active notifications but are activated with -+ /// the next notify. If a delegate is removed during a notify(), the -+ /// delegate will no longer be invoked (unless it has already been -+ /// invoked prior to removal). If one of the delegates throws an exception, -+ /// the execution is aborted and the exception is propagated to the caller. -+ { -+ NotifyAsyncParams params(pSender); -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ -+ // thread-safeness: -+ // copy should be faster and safer than blocking until -+ // execution ends -+ // make a copy of the strategy here to guarantee that -+ // between notifyAsync and the execution of the method no changes can occur -+ -+ params.ptrStrat = SharedPtr(new TStrategy(_strategy)); -+ params.enabled = _enabled; -+ } -+ ActiveResult result = _executeAsync(params); -+ return result; -+ } -+ -+ void enable() -+ /// Enables the event. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ _enabled = true; -+ } -+ -+ void disable() -+ /// Disables the event. notify and notifyAsnyc will be ignored, -+ /// but adding/removing delegates is still allowed. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ _enabled = false; -+ } -+ -+ bool isEnabled() const -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ return _enabled; -+ } -+ -+ void clear() -+ /// Removes all delegates. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ _strategy.clear(); -+ } -+ -+ bool empty() const -+ /// Checks if any delegates are registered at the delegate. -+ { -+ typename TMutex::ScopedLock lock(_mutex); -+ return _strategy.empty(); -+ } -+ -+protected: -+ struct NotifyAsyncParams -+ { -+ SharedPtr ptrStrat; -+ const void* pSender; -+ bool enabled; -+ -+ NotifyAsyncParams(const void* pSend):ptrStrat(), pSender(pSend), enabled(true) -+ /// Default constructor reduces the need for TArgs to have an empty constructor, only copy constructor is needed. -+ { -+ } -+ }; -+ -+ ActiveMethod _executeAsync; -+ -+ void executeAsyncImpl(const NotifyAsyncParams& par) -+ { -+ if (!par.enabled) -+ { -+ return; -+ } -+ -+ NotifyAsyncParams params = par; -+ params.ptrStrat->notify(params.pSender); -+ return; -+ } -+ -+ TStrategy _strategy; /// The strategy used to notify observers. -+ bool _enabled; /// Stores if an event is enabled. Notfies on disabled events have no effect -+ /// but it is possible to change the observers. -+ mutable TMutex _mutex; -+ -+private: -+ AbstractEvent(const AbstractEvent& other); -+ AbstractEvent& operator = (const AbstractEvent& other); -+}; - - } // namespace Poco - -diff -ru Poco/FunctionPriorityDelegate.h work-Poco/FunctionPriorityDelegate.h ---- Poco/FunctionPriorityDelegate.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/FunctionPriorityDelegate.h 2013-09-26 16:02:50.000000000 +0100 -@@ -260,6 +260,214 @@ - }; - - -+template <> -+class FunctionPriorityDelegate: public AbstractPriorityDelegate -+ /// Wraps a freestanding function or static member function -+ /// for use as a PriorityDelegate. -+{ -+public: -+ typedef void (*NotifyMethod)(const void*); -+ -+ FunctionPriorityDelegate(NotifyMethod method, int prio): -+ AbstractPriorityDelegate(prio), -+ _receiverMethod(method) -+ { -+ } -+ -+ FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): -+ AbstractPriorityDelegate(delegate), -+ _receiverMethod(delegate._receiverMethod) -+ { -+ } -+ -+ FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate& delegate) -+ { -+ if (&delegate != this) -+ { -+ this->_receiverMethod = delegate._receiverMethod; -+ this->_priority = delegate._priority; -+ } -+ return *this; -+ } -+ -+ ~FunctionPriorityDelegate() -+ { -+ } -+ -+ bool notify(const void* sender) -+ { -+ Mutex::ScopedLock lock(_mutex); -+ if (_receiverMethod) -+ { -+ (*_receiverMethod)(sender); -+ return true; -+ } -+ else return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast(other.unwrap()); -+ return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod; -+ } -+ -+ AbstractDelegate* clone() const -+ { -+ return new FunctionPriorityDelegate(*this); -+ } -+ -+ void disable() -+ { -+ Mutex::ScopedLock lock(_mutex); -+ _receiverMethod = 0; -+ } -+ -+protected: -+ NotifyMethod _receiverMethod; -+ Mutex _mutex; -+ -+private: -+ FunctionPriorityDelegate(); -+}; -+ -+ -+template <> -+class FunctionPriorityDelegate: public AbstractPriorityDelegate -+{ -+public: -+ typedef void (*NotifyMethod)(void*); -+ -+ FunctionPriorityDelegate(NotifyMethod method, int prio): -+ AbstractPriorityDelegate(prio), -+ _receiverMethod(method) -+ { -+ } -+ -+ FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): -+ AbstractPriorityDelegate(delegate), -+ _receiverMethod(delegate._receiverMethod) -+ { -+ } -+ -+ FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate& delegate) -+ { -+ if (&delegate != this) -+ { -+ this->_receiverMethod = delegate._receiverMethod; -+ this->_priority = delegate._priority; -+ } -+ return *this; -+ } -+ -+ ~FunctionPriorityDelegate() -+ { -+ } -+ -+ bool notify(const void* sender) -+ { -+ Mutex::ScopedLock lock(_mutex); -+ if (_receiverMethod) -+ { -+ (*_receiverMethod)(const_cast(sender)); -+ return true; -+ } -+ else return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast(other.unwrap()); -+ return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod; -+ } -+ -+ AbstractDelegate* clone() const -+ { -+ return new FunctionPriorityDelegate(*this); -+ } -+ -+ void disable() -+ { -+ Mutex::ScopedLock lock(_mutex); -+ _receiverMethod = 0; -+ } -+ -+protected: -+ NotifyMethod _receiverMethod; -+ Mutex _mutex; -+ -+private: -+ FunctionPriorityDelegate(); -+}; -+ -+ -+template <> -+class FunctionPriorityDelegate: public AbstractPriorityDelegate -+{ -+public: -+ typedef void (*NotifyMethod)(); -+ -+ FunctionPriorityDelegate(NotifyMethod method, int prio): -+ AbstractPriorityDelegate(prio), -+ _receiverMethod(method) -+ { -+ } -+ -+ FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate): -+ AbstractPriorityDelegate(delegate), -+ _receiverMethod(delegate._receiverMethod) -+ { -+ } -+ -+ FunctionPriorityDelegate& operator = (const FunctionPriorityDelegate& delegate) -+ { -+ if (&delegate != this) -+ { -+ this->_receiverMethod = delegate._receiverMethod; -+ this->_priority = delegate._priority; -+ } -+ return *this; -+ } -+ -+ ~FunctionPriorityDelegate() -+ { -+ } -+ -+ bool notify(const void* sender) -+ { -+ Mutex::ScopedLock lock(_mutex); -+ if (_receiverMethod) -+ { -+ (*_receiverMethod)(); -+ return true; -+ } -+ else return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast(other.unwrap()); -+ return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod; -+ } -+ -+ AbstractDelegate* clone() const -+ { -+ return new FunctionPriorityDelegate(*this); -+ } -+ -+ void disable() -+ { -+ Mutex::ScopedLock lock(_mutex); -+ _receiverMethod = 0; -+ } -+ -+protected: -+ NotifyMethod _receiverMethod; -+ Mutex _mutex; -+ -+private: -+ FunctionPriorityDelegate(); -+}; -+ - } // namespace Poco - - -diff -ru Poco/Net/X509Certificate.h work-Poco/Net/X509Certificate.h ---- Poco/Net/X509Certificate.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/Net/X509Certificate.h 2013-09-26 16:03:48.000000000 +0100 -@@ -87,7 +87,9 @@ - - ~X509Certificate(); - /// Destroys the X509Certificate. -- -+#ifdef verify -+#undef verify -+#endif - bool verify(const std::string& hostName) const; - /// Verifies the validity of the certificate against the host name. - /// -diff -ru Poco/PriorityDelegate.h work-Poco/PriorityDelegate.h ---- Poco/PriorityDelegate.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/PriorityDelegate.h 2013-09-26 16:04:35.000000000 +0100 -@@ -198,6 +198,152 @@ - }; - - -+template -+class PriorityDelegate: public AbstractPriorityDelegate -+{ -+public: -+ typedef void (TObj::*NotifyMethod)(const void*); -+ -+ PriorityDelegate(TObj* obj, NotifyMethod method, int prio): -+ AbstractPriorityDelegate(prio), -+ _receiverObject(obj), -+ _receiverMethod(method) -+ { -+ } -+ -+ PriorityDelegate(const PriorityDelegate& delegate): -+ AbstractPriorityDelegate(delegate), -+ _receiverObject(delegate._receiverObject), -+ _receiverMethod(delegate._receiverMethod) -+ { -+ } -+ -+ PriorityDelegate& operator = (const PriorityDelegate& delegate) -+ { -+ if (&delegate != this) -+ { -+ this->_pTarget = delegate._pTarget; -+ this->_receiverObject = delegate._receiverObject; -+ this->_receiverMethod = delegate._receiverMethod; -+ this->_priority = delegate._priority; -+ } -+ return *this; -+ } -+ -+ ~PriorityDelegate() -+ { -+ } -+ -+ bool notify(const void* sender) -+ { -+ Mutex::ScopedLock lock(_mutex); -+ if (_receiverObject) -+ { -+ (_receiverObject->*_receiverMethod)(sender); -+ return true; -+ } -+ else return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ const PriorityDelegate* pOtherDelegate = dynamic_cast(other.unwrap()); -+ return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; -+ } -+ -+ AbstractDelegate* clone() const -+ { -+ return new PriorityDelegate(*this); -+ } -+ -+ void disable() -+ { -+ Mutex::ScopedLock lock(_mutex); -+ _receiverObject = 0; -+ } -+ -+protected: -+ TObj* _receiverObject; -+ NotifyMethod _receiverMethod; -+ Mutex _mutex; -+ -+private: -+ PriorityDelegate(); -+}; -+ -+template -+class PriorityDelegate: public AbstractPriorityDelegate -+{ -+public: -+ typedef void (TObj::*NotifyMethod)(); -+ -+ PriorityDelegate(TObj* obj, NotifyMethod method, int prio): -+ AbstractPriorityDelegate(prio), -+ _receiverObject(obj), -+ _receiverMethod(method) -+ { -+ } -+ -+ PriorityDelegate(const PriorityDelegate& delegate): -+ AbstractPriorityDelegate(delegate), -+ _receiverObject(delegate._receiverObject), -+ _receiverMethod(delegate._receiverMethod) -+ { -+ } -+ -+ PriorityDelegate& operator = (const PriorityDelegate& delegate) -+ { -+ if (&delegate != this) -+ { -+ this->_pTarget = delegate._pTarget; -+ this->_receiverObject = delegate._receiverObject; -+ this->_receiverMethod = delegate._receiverMethod; -+ this->_priority = delegate._priority; -+ } -+ return *this; -+ } -+ -+ ~PriorityDelegate() -+ { -+ } -+ -+ bool notify(const void* sender) -+ { -+ Mutex::ScopedLock lock(_mutex); -+ if (_receiverObject) -+ { -+ (_receiverObject->*_receiverMethod)(); -+ return true; -+ } -+ return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ const PriorityDelegate* pOtherDelegate = dynamic_cast(other.unwrap()); -+ return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; -+ } -+ -+ AbstractDelegate* clone() const -+ { -+ return new PriorityDelegate(*this); -+ } -+ -+ void disable() -+ { -+ Mutex::ScopedLock lock(_mutex); -+ _receiverObject = 0; -+ } -+ -+protected: -+ TObj* _receiverObject; -+ NotifyMethod _receiverMethod; -+ Mutex _mutex; -+ -+private: -+ PriorityDelegate(); -+}; -+ - template - static PriorityDelegate priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&), int prio) - { -@@ -268,6 +414,73 @@ - } - - -+ -+ -+ -+template -+static PriorityDelegate priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*), int prio) -+{ -+ return PriorityDelegate(pObj, NotifyMethod, prio); -+} -+ -+ -+template -+static PriorityDelegate priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(), int prio) -+{ -+ return PriorityDelegate(pObj, NotifyMethod, prio); -+} -+ -+ -+template -+static PriorityExpire priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*), int prio, Timestamp::TimeDiff expireMilliSec) -+{ -+ return PriorityExpire(PriorityDelegate(pObj, NotifyMethod, prio), expireMilliSec); -+} -+ -+ -+template -+static PriorityExpire priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(), int prio, Timestamp::TimeDiff expireMilliSec) -+{ -+ return PriorityExpire(PriorityDelegate(pObj, NotifyMethod, prio), expireMilliSec); -+} -+ -+ -+inline PriorityExpire priorityDelegate(void (*NotifyMethod)(const void*), int prio, Timestamp::TimeDiff expireMilliSec) -+{ -+ return PriorityExpire(FunctionPriorityDelegate(NotifyMethod, prio), expireMilliSec); -+} -+ -+ -+inline PriorityExpire priorityDelegate(void (*NotifyMethod)(void*), int prio, Timestamp::TimeDiff expireMilliSec) -+{ -+ return PriorityExpire(FunctionPriorityDelegate(NotifyMethod, prio), expireMilliSec); -+} -+ -+ -+inline PriorityExpire priorityDelegate(void (*NotifyMethod)(), int prio, Timestamp::TimeDiff expireMilliSec) -+{ -+ return PriorityExpire(FunctionPriorityDelegate(NotifyMethod, prio), expireMilliSec); -+} -+ -+ -+inline FunctionPriorityDelegate priorityDelegate(void (*NotifyMethod)(const void*), int prio) -+{ -+ return FunctionPriorityDelegate(NotifyMethod, prio); -+} -+ -+ -+inline FunctionPriorityDelegate priorityDelegate(void (*NotifyMethod)(void*), int prio) -+{ -+ return FunctionPriorityDelegate(NotifyMethod, prio); -+} -+ -+ -+inline FunctionPriorityDelegate priorityDelegate(void (*NotifyMethod)(), int prio) -+{ -+ return FunctionPriorityDelegate(NotifyMethod, prio); -+} -+ -+ - } // namespace Poco - - -diff -ru Poco/PriorityExpire.h work-Poco/PriorityExpire.h ---- Poco/PriorityExpire.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/PriorityExpire.h 2013-09-26 16:02:21.000000000 +0100 -@@ -129,7 +129,85 @@ - PriorityExpire(); - }; - -+template <> -+class PriorityExpire: public AbstractPriorityDelegate -+ /// Decorator for AbstractPriorityDelegate adding automatic -+ /// expiring of registrations to AbstractPriorityDelegate. -+{ -+public: -+ PriorityExpire(const AbstractPriorityDelegate& p, Timestamp::TimeDiff expireMilliSec): -+ AbstractPriorityDelegate(p), -+ _pDelegate(static_cast*>(p.clone())), -+ _expire(expireMilliSec*1000) -+ { -+ } - -+ PriorityExpire(const PriorityExpire& expire): -+ AbstractPriorityDelegate(expire), -+ _pDelegate(static_cast*>(expire._pDelegate->clone())), -+ _expire(expire._expire), -+ _creationTime(expire._creationTime) -+ { -+ } -+ -+ ~PriorityExpire() -+ { -+ delete _pDelegate; -+ } -+ -+ PriorityExpire& operator = (const PriorityExpire& expire) -+ { -+ if (&expire != this) -+ { -+ delete this->_pDelegate; -+ this->_pDelegate = static_cast*>(expire._pDelegate->clone()); -+ this->_expire = expire._expire; -+ this->_creationTime = expire._creationTime; -+ } -+ return *this; -+ } -+ -+ bool notify(const void* sender) -+ { -+ if (!expired()) -+ return this->_pDelegate->notify(sender); -+ else -+ return false; -+ } -+ -+ bool equals(const AbstractDelegate& other) const -+ { -+ return other.equals(*_pDelegate); -+ } -+ -+ AbstractPriorityDelegate* clone() const -+ { -+ return new PriorityExpire(*this); -+ } -+ -+ void disable() -+ { -+ _pDelegate->disable(); -+ } -+ -+ const AbstractPriorityDelegate* unwrap() const -+ { -+ return this->_pDelegate; -+ } -+ -+protected: -+ bool expired() const -+ { -+ return _creationTime.isElapsed(_expire); -+ } -+ -+ AbstractPriorityDelegate* _pDelegate; -+ Timestamp::TimeDiff _expire; -+ Timestamp _creationTime; -+ -+private: -+ PriorityExpire(); -+}; - } // namespace Poco - - -diff -ru Poco/PriorityStrategy.h work-Poco/PriorityStrategy.h ---- Poco/PriorityStrategy.h 2013-09-26 16:11:44.000000000 +0100 -+++ work-Poco/PriorityStrategy.h 2013-09-26 16:02:39.000000000 +0100 -@@ -135,7 +135,80 @@ - Delegates _delegates; - }; - -+template -+class PriorityStrategy -+ /// NotificationStrategy for PriorityEvent. -+ /// -+ /// Delegates are kept in a std::vector<>, ordered -+ /// by their priority. -+{ -+public: -+ typedef SharedPtr DelegatePtr; -+ typedef std::vector Delegates; -+ typedef typename Delegates::iterator Iterator; - -+public: -+ -+ void notify(const void* sender) -+ { -+ for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it) -+ { -+ (*it)->notify(sender); -+ } -+ } -+ -+ void add(const TDelegate& delegate) -+ { -+ for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it) -+ { -+ if ((*it)->priority() > delegate.priority()) -+ { -+ _delegates.insert(it, DelegatePtr(static_cast(delegate.clone()))); -+ return; -+ } -+ } -+ _delegates.push_back(DelegatePtr(static_cast(delegate.clone()))); -+ } -+ -+ void remove(const TDelegate& delegate) -+ { -+ for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it) -+ { -+ if (delegate.equals(**it)) -+ { -+ (*it)->disable(); -+ _delegates.erase(it); -+ return; -+ } -+ } -+ } -+ -+ PriorityStrategy& operator = (const PriorityStrategy& s) -+ { -+ if (this != &s) -+ { -+ _delegates = s._delegates; -+ } -+ return *this; -+ } -+ -+ void clear() -+ { -+ for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it) -+ { -+ (*it)->disable(); -+ } -+ _delegates.clear(); -+ } -+ -+ bool empty() const -+ { -+ return _delegates.empty(); -+ } -+ -+protected: -+ Delegates _delegates; -+}; - } // namespace Poco - - diff --git a/scripts/apothecary/formulas/poco/poco.sh b/scripts/apothecary/formulas/poco/poco.sh index 8582c2e38f9..ee9840f6ac2 100644 --- a/scripts/apothecary/formulas/poco/poco.sh +++ b/scripts/apothecary/formulas/poco/poco.sh @@ -8,28 +8,28 @@ # specify specfic build configs in poco/config using ./configure --config=NAME # define the version -VER=1.5.2-release +VER=apothecary-1.7 # tools for git use -GIT_URL=https://github.com/pocoproject/poco +GIT_URL=https://github.com/bakercp/poco GIT_TAG=poco-$VER -# @tgfrerer: we need more fine-grained control over poco source code versions, -# which is why we specify the specific poco source code commit we want to use - -# When updating poco/this recipe, make sure to specify the proper hash here, -# and check if the header patches still apply cleanly. +# For Poco Builds, we omit both Data/MySQL and Data/ODBC because they require +# 3rd Party libraries. See https://github.com/pocoproject/poco/blob/develop/README +# for more information. -# @TODO: New commit ref? SHA= # download the source code and unpack it into LIB_NAME function download() { if [ "$SHA" == "" ] ; then + echo "SHA=="" $GIT_URL" curl -Lk $GIT_URL/archive/$GIT_TAG.tar.gz -o poco-$GIT_TAG.tar.gz tar -xf poco-$GIT_TAG.tar.gz mv poco-$GIT_TAG poco rm poco*.tar.gz else + echo $GIT_URL git clone $GIT_URL -b poco-$VER fi } @@ -42,30 +42,83 @@ function prepare() { # make backups of the ios config files since we need to edit them if [ "$TYPE" == "ios" ] ; then + mkdir -p lib/$TYPE + mkdir -p lib/iPhoneOS + cd build/config - cp iPhone iPhone.orig - cp iPhoneSimulator iPhoneSimulator.orig + + cp iPhoneSimulator-clang-libc++ iPhoneSimulator-clang-libc++.orig + cp iPhone-clang-libc++ iPhone-clang-libc++.orig + + # fix using sed i636 reference and allow overloading variable + sed -i .tmp "s|POCO_TARGET_OSARCH.* = .*|POCO_TARGET_OSARCH ?= i386|" iPhoneSimulator-clang-libc++ + sed -i .tmp "s|OSFLAGS = -arch|OSFLAGS ?= -arch|" iPhoneSimulator-clang-libc++ + sed -i .tmp "s|STATICOPT_CC =|STATICOPT_CC ?= -DNDEBUG -DPOCO_ENABLE_CPP11 -Os -fPIC|" iPhone-clang-libc++ + sed -i .tmp "s|STATICOPT_CXX =|STATICOPT_CXX ?= -DNDEBUG -DPOCO_ENABLE_CPP11 -Os -fPIC|" iPhone-clang-libc++ + sed -i .tmp "s|OSFLAGS = -arch|OSFLAGS ?= -arch|" iPhone-clang-libc++ + sed -i .tmp "s|RELEASEOPT_CC = -DNDEBUG -O2|RELEASEOPT_CC = -DNDEBUG -DPOCO_ENABLE_CPP11 -Os -fPIC|" iPhone-clang-libc++ + sed -i .tmp "s|RELEASEOPT_CXX = -DNDEBUG -O |RELEASEOPT_CXX = -DNDEBUG -DPOCO_ENABLE_CPP11 -Os -fPIC|" iPhone-clang-libc++ + + cd ../rules/ + cp compile compile.orig + # Fix for making debug and release, making just release + sed -i .tmp "s|all_static: static_debug static_release|all_static: static_release|" compile + cd ../../ + + elif [ "$TYPE" == "vs" ] ; then + # Patch the components to exclude those that we aren't using. + if patch -p0 -u -N --dry-run --silent < $FORMULA_DIR/components.patch 2>/dev/null ; then + patch -p0 -u < $FORMULA_DIR/components.patch + fi + + # Locate the path of the openssl libs distributed with openFrameworks. + local OF_LIBS_OPENSSL="$LIBS_DIR/openssl/" + + # get the absolute path to the included openssl libs + local OF_LIBS_OPENSSL_ABS_PATH=$(cd $(dirname $OF_LIBS_OPENSSL); pwd)/$(basename $OF_LIBS_OPENSSL) + + # convert the absolute path from unix to windows + local OPENSSL_DIR=$(echo $OF_LIBS_OPENSSL_ABS_PATH | sed 's/^\///' | sed 's/\//\\/g' | sed 's/^./\0:/') + + # escape windows slashes and a few common escape sequences before passing to sed + local OPENSSL_DIR=$(echo $OPENSSL_DIR | sed 's/\\/\\\\\\/g' | sed 's/\\\U/\\\\U/g' | sed 's/\\\l/\\\\l/g') + + # replace OPENSSL_DIR=C:\OpenSSL with our OPENSSL_DIR + sed -i.tmp "s|C:\\\OpenSSL|$OPENSSL_DIR|g" buildwin.cmd + + # replace OPENSSL_LIB=%OPENSSL_DIR%\lib;%OPENSSL_DIR%\lib\VC with OPENSSL_LIB=%OPENSSL_DIR%\lib\vs + sed -i.tmp "s|%OPENSSL_DIR%\\\lib;.*|%OPENSSL_DIR%\\\lib\\\vs|g" buildwin.cmd + elif [ "$TYPE" == "android" ] ; then + installAndroidToolchain fi + } # executed inside the lib src dir function build() { if [ "$TYPE" == "osx" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" - + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" + # 32 bit - ./configure $BUILD_OPTS --config=Darwin32 + # For OS 10.9+ we must explicitly set libstdc++ for the 32-bit OSX build. + ./configure $BUILD_OPTS --cflags=-stdlib=libstdc++ --config=Darwin32 make # 64 bit - ./configure $BUILD_OPTS --config=Darwin64 + + export POCO_ENABLE_CPP11=1 + + ./configure $BUILD_OPTS --config=Darwin64-clang-libc++ make + unset POCO_ENABLE_CPP11 + cd lib/Darwin # delete debug builds - rm i386/*d.a x86_64/*d.a + rm i386/*d.a + rm x86_64/*d.a # link into universal lib, strip "lib" from filename local lib @@ -76,110 +129,269 @@ function build() { fi done - elif [ "$TYPE" == "osx-clang-libc++" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" - - # @tgfrerer: osx libraries in openFrameworks/master are currently "lean" 32 bit libraries. - # so we omit the 64 bit compilation target for now. + elif [ "$TYPE" == "vs" ] ; then + cmd //c buildwin.cmd ${VS_VER}0 build static_md both Win32 nosamples notests - # 32 bit - ./configure $BUILD_OPTS --config=Darwin32-clang-libc++ - make + elif [ "$TYPE" == "win_cb" ] ; then + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" - cd lib/Darwin + # Locate the path of the openssl libs distributed with openFrameworks. + local OF_LIBS_OPENSSL="$LIBS_DIR/openssl/" - # delete debug builds - rm i386/*d.a + # get the absolute path to the included openssl libs + local OF_LIBS_OPENSSL_ABS_PATH=$(cd $(dirname $OF_LIBS_OPENSSL); pwd)/$(basename $OF_LIBS_OPENSSL) - # link into universal lib, strip "lib" from filename - local lib - for lib in $( ls -1 i386) ; do - local renamedLib=$(echo $lib | sed 's|lib||') - if [ ! -e $renamedLib ] ; then - #lipo -c i386/$lib x86_64/$lib -o $renamedLib - libtool -static -o $renamedLib i386/$lib - fi - done + local OPENSSL_INCLUDE=$OF_LIBS_OPENSSL_ABS_PATH/include + local OPENSSL_LIBS=$OF_LIBS_OPENSSL_ABS_PATH/lib/win_cb - elif [ "$TYPE" == "vs" ] ; then - #cmd.exe /c "buildwin.cmd "$VS_VER" build all both Win32 nosamples devenv" - ## OR - cmake -G "Visual Studio $VS_VER" -DPOCO_STATIC="1" -DCMAKE_DEBUG_POSTFIX="mdd" -DCMAKE_RELEASE_POSTFIX="md" - vs-build "Poco.sln" Build Debug - vs-build "Poco.sln" Build Release - - elif [ "$TYPE" == "ios" ] ; then + ./configure $BUILD_OPTS \ + --include-path=$OPENSSL_INCLUDE \ + --library-path=$OPENSSL_LIBS \ + --config=MinGW - # maybe --poquito is a good idea? - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC,NetSSL_OpenSSL,Crypto" + make - cp build/config/iPhone.orig build/config/iPhone - cp build/config/iPhoneSimulator.orig build/config/iPhoneSimulator + # Delete debug libs. + lib/MinGW/i686/*d.a - # set SDK - sed -i .tmp "s|#.*IPHONE_SDK_VERSION =.*|IPHONE_SDK_VERSION = $IOS_SDK_VER|" build/config/iPhone + elif [ "$TYPE" == "ios" ] ; then - # fix any xcode path issues (currently fixed in newer poco, done here manually for now) - sed -i .tmp 's|= /Developer|= $(shell xcode-select -print-path)|' build/config/iPhone - sed -i .tmp 's|= /Developer|= $(shell xcode-select -print-path)|' build/config/iPhoneSimulator - # armv7 - sed -i .tmp "s|POCO_TARGET_OSARCH.*?=.*|POCO_TARGET_OSARCH ?= armv7|" build/config/iPhone - ./configure $BUILD_OPTS --config=iPhone - make + SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` + set -e + CURRENTPATH=`pwd` + + DEVELOPER=$XCODE_DEV_ROOT + TOOLCHAIN=${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain + VERSION=$VER + + local IOS_ARCHS="i386 x86_64 armv7 arm64" + echo "--------------------" + echo $CURRENTPATH + + # Validate environment + case $XCODE_DEV_ROOT in + *\ * ) + echo "Your Xcode path contains whitespaces, which is not supported." + exit 1 + ;; + esac + case $CURRENTPATH in + *\ * ) + echo "Your path contains whitespaces, which is not supported by 'make install'." + exit 1 + ;; + esac + + echo "------------" + # To Fix: global:62: *** Current working directory not under $PROJECT_BASE. Stop. make + echo "Note: For Poco, make sure to call it with lowercase poco name: ./apothecary -t ios update poco" + echo "----------" + + local BUILD_POCO_CONFIG_IPHONE=iPhone-clang-libc++ + local BUILD_POCO_CONFIG_SIMULATOR=iPhoneSimulator-clang-libc++ + + # Locate the path of the openssl libs distributed with openFrameworks. + local OF_LIBS_OPENSSL="$LIBS_DIR/openssl/" + + # get the absolute path to the included openssl libs + local OF_LIBS_OPENSSL_ABS_PATH=$(cd $(dirname $OF_LIBS_OPENSSL); pwd)/$(basename $OF_LIBS_OPENSSL) + + local OPENSSL_INCLUDE=$OF_LIBS_OPENSSL_ABS_PATH/include + local OPENSSL_LIBS=$OF_LIBS_OPENSSL_ABS_PATH/lib/ios + + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen --include-path=$OPENSSL_INCLUDE --library-path=$OPENSSL_LIBS" + + STATICOPT_CC=-fPIC + STATICOPT_CXX=-fPIC + + # loop through architectures! yay for loops! + for IOS_ARCH in ${IOS_ARCHS} + do + MIN_IOS_VERSION=$IOS_MIN_SDK_VER + # min iOS version for arm64 is iOS 7 + + if [[ "${IOS_ARCH}" == "arm64" || "${IOS_ARCH}" == "x86_64" ]]; then + MIN_IOS_VERSION=7.0 # 7.0 as this is the minimum for these architectures + elif [ "${IOS_ARCH}" == "i386" ]; then + MIN_IOS_VERSION=5.1 # 6.0 to prevent start linking errors + fi + export IPHONE_SDK_VERSION_MIN=$IOS_MIN_SDK_VER + + export POCO_TARGET_OSARCH=$IOS_ARCH + + MIN_TYPE=-miphoneos-version-min= + if [[ "${IOS_ARCH}" == "i386" || "${IOS_ARCH}" == "x86_64" ]]; + then + PLATFORM="iPhoneSimulator" + BUILD_POCO_CONFIG=$BUILD_POCO_CONFIG_SIMULATOR + MIN_TYPE=-mios-simulator-version-min= + else + PLATFORM="iPhoneOS" + BUILD_POCO_CONFIG=$BUILD_POCO_CONFIG_SIMULATOR + fi - # armv7s - sed -i .tmp "s|POCO_TARGET_OSARCH.*?=.*|POCO_TARGET_OSARCH ?= armv7s|" build/config/iPhone - ./configure $BUILD_OPTS --config=iPhone - make + export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" + export BUILD_TOOLS="${DEVELOPER}" - # simulator - sed -i .tmp "s|POCO_TARGET_OSARCH.* = .*|POCO_TARGET_OSARCH = i386|" build/config/iPhoneSimulator - ./configure $BUILD_OPTS --config=iPhoneSimulator - make + mkdir -p "$CURRENTPATH/build/$TYPE/$IOS_ARCH" + LOG="$CURRENTPATH/build/$TYPE/$IOS_ARCH/poco-$IOS_ARCH-${VER}.log" + set +e - cd lib/iPhoneOS + if [[ "${IOS_ARCH}" == "i386" || "${IOS_ARCH}" == "x86_64" ]]; + then + export OSFLAGS="-arch $POCO_TARGET_OSARCH -fPIC -DPOCO_ENABLE_CPP11 -isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} $MIN_TYPE$IPHONE_SDK_VERSION_MIN" + else + export OSFLAGS="-arch $POCO_TARGET_OSARCH -fPIC -DPOCO_ENABLE_CPP11 -isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} $MIN_TYPE$IPHONE_SDK_VERSION_MIN" + fi + echo "--------------------" + echo "Making Poco-${VER} for ${PLATFORM} ${SDKVERSION} ${IOS_ARCH} : iOS Minimum=$MIN_IOS_VERSION" + echo "--------------------" + echo "Configuring for ${IOS_ARCH} ..." + ./configure $BUILD_OPTS --config=$BUILD_POCO_CONFIG_IPHONE > "${LOG}" 2>&1 + + if [ $? != 0 ]; then + echo "Problem while configure - Please check ${LOG}" + exit 1 + else + echo "Configure successful" + fi + echo "--------------------" + echo "Running make for ${IOS_ARCH}" + echo "To see status in realtime check:" + echo " ${LOG}" + echo "Please stand by..." + make >> "${LOG}" 2>&1 + if [ $? != 0 ]; + then + echo "Problem while make - Please check ${LOG}" + exit 1 + else + echo "Make Successful for ${IOS_ARCH}" + fi + unset POCO_TARGET_OSARCH IPHONE_SDK_VERSION_MIN OSFLAGS + unset CROSS_TOP CROSS_SDK BUILD_TOOLS + + echo "--------------------" - # delete debug builds - rm armv7/*d.a armv7s/*d.a ../iPhoneSimulator/i386/*d.a + done + cd lib/iPhoneOS # link into universal lib, strip "lib" from filename local lib - for lib in $( ls -1 ../iPhoneSimulator/i386) ; do + for lib in $( ls -1 i386) ; do local renamedLib=$(echo $lib | sed 's|lib||') if [ ! -e $renamedLib ] ; then - lipo -c armv7/$lib armv7s/$lib ../iPhoneSimulator/i386/$lib -o $renamedLib + lipo -c armv7/$lib arm64/$lib i386/$lib x86_64/$lib -o ../ios/$renamedLib fi done + cd ../../ + + echo "--------------------" + echo "Stripping any lingering symbols" + + cd lib/$TYPE + SLOG="$CURRENTPATH/lib/$TYPE-stripping.log" + local TOBESTRIPPED + for TOBESTRIPPED in $( ls -1) ; do + strip -x $TOBESTRIPPED >> "${SLOG}" 2>&1 + if [ $? != 0 ]; + then + echo "Problem while stripping lib - Please check ${SLOG}" + exit 1 + else + echo "Strip Successful for ${SLOG}" + fi + done + + + cd ../../ + + echo "--------------------" + echo "Reseting changed files back to originals" + cd build/config + cp iPhoneSimulator-clang-libc++.orig iPhoneSimulator-clang-libc++ + cp iPhone-clang-libc++.orig iPhone-clang-libc++ + cd ../rules/ + cp compile.orig compile + cd ../../ + echo "--------------------" + + echo "Completed." + elif [ "$TYPE" == "android" ] ; then - echoWarning "TODO: android build" + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" + + local OLD_PATH=$PATH + + export PATH=$PATH:$BUILD_DIR/Toolchains/Android/androideabi/bin:$BUILD_DIR/Toolchains/Android/x86/bin + + local OF_LIBS_OPENSSL="$LIBS_DIR/openssl/" + + # get the absolute path to the included openssl libs + local OF_LIBS_OPENSSL_ABS_PATH=$(cd $(dirname $OF_LIBS_OPENSSL); pwd)/$(basename $OF_LIBS_OPENSSL) + + local OPENSSL_INCLUDE=$OF_LIBS_OPENSSL_ABS_PATH/include + local OPENSSL_LIBS=$OF_LIBS_OPENSSL_ABS_PATH/lib/ + + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" + + ./configure $BUILD_OPTS \ + --include-path=$OPENSSL_INCLUDE \ + --library-path=$OPENSSL_LIBS/armeabi \ + --config=Android + + make ANDROID_ABI=armeabi + + ./configure $BUILD_OPTS \ + --include-path=$OPENSSL_INCLUDE \ + --library-path=$OPENSSL_LIBS/armeabi-v7a \ + --config=Android + + make ANDROID_ABI=armeabi-v7a + + ./configure $BUILD_OPTS \ + --include-path=$OPENSSL_INCLUDE \ + --library-path=$OPENSSL_LIBS/x86 \ + --config=Android + + make ANDROID_ABI=x86 + + echo `pwd` + + rm -v lib/Android/armeabi/*d.a + rm -v lib/Android/armeabi-v7a/*d.a + rm -v lib/Android/x86/*d.a + + export PATH=$OLD_PATH elif [ "$TYPE" == "linux" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" ./configure $BUILD_OPTS make # delete debug builds - rm lib/Linux/i386/*d.a + rm lib/Linux/$(uname -m)/*d.a elif [ "$TYPE" == "linux64" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" ./configure $BUILD_OPTS make # delete debug builds rm lib/Linux/x86_64/*d.a elif [ "$TYPE" == "linuxarmv6l" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" ./configure $BUILD_OPTS make # delete debug builds rm lib/Linux/armv6l/*d.a elif [ "$TYPE" == "linuxarmv7l" ] ; then - local BUILD_OPTS="--no-tests --no-samples --static --omit=Data/MySQL,Data/SQLite,Data/ODBC" + local BUILD_OPTS="--no-tests --no-samples --static --omit=CppUnit,CppUnit/WinTestRunner,Data/MySQL,Data/ODBC,PageCompiler,PageCompiler/File2Page,CppParser,PDF,PocoDoc,ProGen" ./configure $BUILD_OPTS make # delete debug builds rm lib/Linux/armv7l/*d.a - else + else echoWarning "TODO: build $TYPE lib" fi } @@ -188,43 +400,36 @@ function build() { function copy() { # headers - mkdir -p $1/include/CppUnit - cp -Rv CppUnit/include/CppUnit/* $1/include/CppUnit - mkdir -p $1/include/Poco - cp -Rv Foundation/include/Poco/* $1/include/Poco + mkdir -pv $1/include/Poco cp -Rv Crypto/include/Poco/Crypto $1/include/Poco cp -Rv Data/include/Poco/Data $1/include/Poco + cp -Rv Data/SQLite/include/Poco/Data $1/include/Poco + cp -Rv Foundation/include/Poco/* $1/include/Poco + cp -Rv JSON/include/Poco/JSON $1/include/Poco + cp -Rv MongoDB/include/Poco/MongoDB $1/include/Poco cp -Rv Net/include/Poco/Net $1/include/Poco cp -Rv NetSSL_OpenSSL/include/Poco/Net/* $1/include/Poco/Net + cp -Rv SevenZip/include/Poco/SevenZip $1/include/Poco cp -Rv Util/include/Poco/Util $1/include/Poco cp -Rv XML/include/Poco/* $1/include/Poco cp -Rv Zip/include/Poco/Zip $1/include/Poco - # @tgfrerer: apply header file patches necessary for events - if patch -d $1/include/Poco -p1 -d -N --dry-run --silent < $FORMULA_DIR/poco.headers.patch 2>/dev/null ; then - patch -d $1/include/Poco -p1 < $FORMULA_DIR/poco.headers.patch - fi - # libs - if [ "$TYPE" == "osx" ] ; then - mkdir -p $1/lib/$TYPE - cp -v lib/Darwin/*.a $1/lib/$TYPE - - elif [ "$TYPE" == "osx-clang-libc++" ] ; then + if [ "$TYPE" == "osx" ] ; then mkdir -p $1/lib/$TYPE cp -v lib/Darwin/*.a $1/lib/$TYPE - elif [ "$TYPE" == "ios" ] ; then mkdir -p $1/lib/$TYPE - cp -v lib/iPhoneOS/*.a $1/lib/$TYPE - + cp -v lib/$TYPE/*.a $1/lib/$TYPE elif [ "$TYPE" == "vs" ] ; then mkdir -p $1/lib/$TYPE - cp -v lib/Release/*.lib $1/lib/$TYPE - cp -v lib/Debug/*.lib $1/lib/$TYPE + cp -v lib/*.lib $1/lib/$TYPE + elif [ "$TYPE" == "win_cb" ] ; then + mkdir -p $1/lib/$TYPE + cp -v lib/MinGW/i686/*.a $1/lib/$TYPE elif [ "$TYPE" == "linux" ] ; then mkdir -p $1/lib/$TYPE - cp -v lib/Linux/i386/*.a $1/lib/$TYPE + cp -v lib/Linux/$(uname -m)/*.a $1/lib/$TYPE elif [ "$TYPE" == "linux64" ] ; then mkdir -p $1/lib/$TYPE cp -v lib/Linux/x86_64/*.a $1/lib/$TYPE @@ -234,6 +439,15 @@ function copy() { elif [ "$TYPE" == "linuxarmv7l" ] ; then mkdir -p $1/lib/$TYPE cp -v lib/Linux/armv7l/*.a $1/lib/$TYPE + elif [ "$TYPE" == "android" ] ; then + mkdir -p $1/lib/$TYPE/armeabi + cp -v lib/Android/armeabi/*.a $1/lib/$TYPE/armeabi + + mkdir -p $1/lib/$TYPE/armeabi-v7a + cp -v lib/Android/armeabi-v7a/*.a $1/lib/$TYPE/armeabi-v7a + + mkdir -p $1/lib/$TYPE/x86 + cp -v lib/Android/x86/*.a $1/lib/$TYPE/x86 else echoWarning "TODO: copy $TYPE lib" fi @@ -243,12 +457,15 @@ function copy() { function clean() { if [ "$TYPE" == "vs" ] ; then - echoWarning "TODO: clean vs" - + cmd //c buildwin.cmd ${VS_VER}0 clean static_md both Win32 nosamples notests elif [ "$TYPE" == "android" ] ; then - echoWarning "TODO: clean android" - + export PATH=$PATH:$ANDROID_TOOLCHAIN_ANDROIDEABI/bin:$ANDROID_TOOLCHAIN_X86/bin + make clean ANDROID_ABI=armeabi + make clean ANDROID_ABI=armeabi-v7a + make clean ANDROID_ABI=x86 + unset PATH else make clean fi + } diff --git a/scripts/apothecary/ostype.sh b/scripts/apothecary/ostype.sh index f5efceba301..ee4b2b88f21 100755 --- a/scripts/apothecary/ostype.sh +++ b/scripts/apothecary/ostype.sh @@ -12,9 +12,9 @@ if [ "$OS" == "darwin" ]; then elif [ "$OS" == "windowsnt" -o "${OS:0:5}" == "mingw" ] ; then OS="windows" elif [ "$OS" == "linux" ]; then - ARCH=`uname -m` - if [ "$ARCH" == "i386" ] ; then - OS="linux" + ARCH=`uname -m` + if [ "$ARCH" == "i386" -o "$ARCH" == "i686" ] ; then + OS="linux" elif [ "$ARCH" == "x86_64" ] ; then OS="linux64" elif [ "$ARCH" == "armv6l" ] ; then