Skip to content

Commit

Permalink
Merge pull request Marketcircle#6 from Marketcircle/ryder/apple-silic…
Browse files Browse the repository at this point in the history
…on-iphonesimulator

Support iphonesimulator on arm64
  • Loading branch information
stevebrambilla authored Sep 21, 2021
2 parents d600b8e + 62607c6 commit 3cb69b0
Show file tree
Hide file tree
Showing 33 changed files with 5,760 additions and 106 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Externals
DerivedData

example/ios/iOS UI Test/DerivedData
scripts/prebuilt.list
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libetpan"]
path = libetpan
url = [email protected]:Marketcircle/libetpan
132 changes: 46 additions & 86 deletions build-mac/mailcore2.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

DERIVED_DATA_DIR="DerivedData"
PRODUCTS_DIR="${DERIVED_DATA_DIR}/Build/Products"

# carthage adds these, not sure if necessary
EXTRA_ARGS="ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="

# Embed bitcode for iphoneos binaries
EXTRA_IPHONEOS_ARGS="ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode"

# libetpan has been set up to build an xcframework for libsasl2, however xcframeworks must exist at the *start* of the build process
# I didn't have time to figure out something less awful than building libetpan first
# It'll copy sasl.xcframework to the build directory
xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "libetpan ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphoneos ${EXTRA_ARGS} ${EXTRA_IPHONEOS_ARGS}
xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "libetpan ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphonesimulator ${EXTRA_ARGS}

# mailcore2 references the sasl.xcframework in the build directory
xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "mailcore ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphoneos ${EXTRA_ARGS} ${EXTRA_IPHONEOS_ARGS}
xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "mailcore ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphonesimulator ${EXTRA_ARGS}

# glue it all together
# note -debug-symbols path has to be absolute, see https://developer.apple.com/forums/thread/655768
xcodebuild -create-xcframework \
-framework "${PRODUCTS_DIR}/Release-iphoneos/MailCore.framework" \
-debug-symbols "${PWD}/${PRODUCTS_DIR}/Release-iphoneos/MailCore.framework.dSYM" \
-framework "${PRODUCTS_DIR}/Release-iphonesimulator/MailCore.framework" \
-debug-symbols "${PWD}/${PRODUCTS_DIR}/Release-iphonesimulator/MailCore.framework.dSYM" \
-output "${PRODUCTS_DIR}/MailCore.xcframework"
70 changes: 70 additions & 0 deletions deps/ctemplate-ios/include/ctemplate/find_ptr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) 2012, Olaf van der Spek <[email protected]>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// ---
// Author: Olaf van der Spek <[email protected]>

#ifndef TEMPLATE_FIND_PTR_H_
#define TEMPLATE_FIND_PTR_H_



namespace ctemplate {

template <class T, class U>
typename T::value_type::second_type* find_ptr(T& c, U v)
{
typename T::iterator i = c.find(v);
return i == c.end() ? NULL : &i->second;
}

template <class T, class U>
const typename T::value_type::second_type* find_ptr(const T& c, U v)
{
typename T::const_iterator i = c.find(v);
return i == c.end() ? NULL : &i->second;
}

template <class T, class U>
typename T::value_type::second_type find_ptr2(T& c, U v)
{
typename T::iterator i = c.find(v);
return i == c.end() ? NULL : i->second;
}

template <class T, class U>
const typename T::value_type::second_type find_ptr2(const T& c, U v)
{
typename T::const_iterator i = c.find(v);
return i == c.end() ? NULL : i->second;
}

}

#endif // TEMPLATE_FIND_PTR_H_
149 changes: 149 additions & 0 deletions deps/ctemplate-ios/include/ctemplate/per_expand_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// ---
// Author: [email protected] (Craig Silverstein)
//
// In addition to a TemplateDictionary, there is also a PerExpandData
// dictionary. This dictionary holds information that applies to one
// call to Expand, such as whether to annotate the template expansion
// output. A template dictionary is associated with a template (.tpl)
// file; a per-expand dictionary is associated to a particular call to
// Expand() in a .cc file.
//
// For (many) more details, see the doc/ directory.

#ifndef TEMPLATE_PER_EXPAND_DATA_H_
#define TEMPLATE_PER_EXPAND_DATA_H_

#include <stdlib.h> // for NULL
#include <string.h> // for strcmp
#include <sys/types.h>
#include <map>
#include <ctemplate/template_string.h> // for StringHash



namespace ctemplate {

class TemplateModifier;
class TemplateAnnotator;

class PerExpandData {
public:
PerExpandData()
: annotate_path_(NULL),
annotator_(NULL),
expand_modifier_(NULL),
map_(NULL) { }

~PerExpandData();

// Indicate that annotations should be inserted during template expansion.
// template_path_start - the start of a template path. When
// printing the filename for template-includes, anything before and
// including template_path_start is elided. This can make the
// output less dependent on filesystem location for template files.
void SetAnnotateOutput(const char* template_path_start) {
annotate_path_ = template_path_start;
}

// Whether to annotate the expanded output.
bool annotate() const { return annotate_path_ != NULL; }

// The annotate-path; undefined if annotate() != true
const char* annotate_path() const { return annotate_path_; }

// This sets the TemplateAnnotator to be used when annotating is on.
// This allows you to override the default text-based annotator
// that will be used if you do not call this. The passed annotator
// will be aliased by this object and returned by annotator().
// Passing NULL has the special behavior of causing annotator() to
// revert to returning its built-in instance.
void SetAnnotator(TemplateAnnotator* annotator) {
annotator_ = annotator;
}

// This returns the TemplateAnnotator to be used when annotating is on.
// The value returned will be either an instance previously provided
// to SetAnnotator() or the callable built-in text-based annotator.
TemplateAnnotator* annotator() const;

// This is a TemplateModifier to be applied to all templates
// expanded via this call to Expand(). That is, this modifier is
// applies to the template (.tpl) file we expand, as well as
// sub-templates that are expanded due to {{>INCLUDE}} directives.
// Caller is responsible for ensuring that modifier exists for the
// lifetime of this object.
void SetTemplateExpansionModifier(const TemplateModifier* modifier) {
expand_modifier_ = modifier;
}

const TemplateModifier* template_expansion_modifier() const {
return expand_modifier_;
}

// Store data in this structure, to be used by template modifiers
// (see template_modifiers.h). Call with value set to NULL to clear
// any value previously set. Caller is responsible for ensuring key
// and value point to valid data for the lifetime of this object.
void InsertForModifiers(const char* key, const void* value);

// Retrieve data specific to this Expand call. Returns NULL if key
// is not found. This should only be used by template modifiers.
const void* LookupForModifiers(const char* key) const;

// Same as Lookup, but casts the result to a c string.
const char* LookupForModifiersAsString(const char* key) const {
return static_cast<const char*>(LookupForModifiers(key));
}

private:
#ifdef _MSC_VER
typedef std::map<const char*, const void*, StringHash> DataMap;
#else
struct DataEq {
bool operator()(const char* s1, const char* s2) const;
};
typedef std::map<const char*, const void*, StringHash>
DataMap;
#endif

const char* annotate_path_;
TemplateAnnotator* annotator_;
const TemplateModifier* expand_modifier_;
DataMap* map_;

PerExpandData(const PerExpandData&); // disallow evil copy constructor
void operator=(const PerExpandData&); // disallow evil operator=
};

}

#endif // TEMPLATE_PER_EXPAND_DATA_H_
129 changes: 129 additions & 0 deletions deps/ctemplate-ios/include/ctemplate/str_ref.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Copyright (c) 2012, Olaf van der Spek <[email protected]>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// ---
// Author: Olaf van der Spek <[email protected]>

#ifndef TEMPLATE_STR_REF_H_
#define TEMPLATE_STR_REF_H_

#include <cstddef>



namespace ctemplate {

template <class T>
class str_ref_basic
{
public:
str_ref_basic()
{
clear();
}

template <class U>
str_ref_basic(const U& c)
{
if (c.end() != c.begin())
assign(&*c.begin(), c.end() - c.begin() + &*c.begin());
else
clear();
}

str_ref_basic(const void* b, const void* e)
{
assign(b, e);
}

str_ref_basic(const void* b, size_t sz)
{
assign(b, sz);
}

str_ref_basic(const char* b)
{
if (b)
assign(b, strlen(b));
else
clear();
}

void clear()
{
begin_ = end_ = NULL;
}

void assign(const void* b, const void* e)
{
begin_ = reinterpret_cast<T>(b);
end_ = reinterpret_cast<T>(e);
}

void assign(const void* b, size_t sz)
{
begin_ = reinterpret_cast<T>(b);
end_ = begin_ + sz;
}

T begin() const
{
return begin_;
}

T end() const
{
return end_;
}

T data() const
{
return begin();
}

size_t size() const
{
return end() - begin();
}

bool empty() const
{
return begin() == end();
}
private:
T begin_;
T end_;
};

typedef str_ref_basic<const unsigned char*> data_ref;
typedef str_ref_basic<const char*> str_ref;

}

#endif // TEMPLATE_STR_REF_H_
Loading

0 comments on commit 3cb69b0

Please sign in to comment.