-
Notifications
You must be signed in to change notification settings - Fork 31
better Swift support #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
radmakr
wants to merge
5
commits into
dogecoinfoundation:0.1.5-dev
Choose a base branch
from
radmakr:ios
base: 0.1.5-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+178
−0
Open
better Swift support #285
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| // swift-tools-version: 5.9 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "libdogecoin", | ||
| platforms: [ | ||
| .iOS(.v15), | ||
| .macOS(.v12) | ||
| ], | ||
| products: [ | ||
| // C library only - Swift wrapper lives in DogecoinKit | ||
| .library( | ||
| name: "clibdogecoin", | ||
| targets: ["clibdogecoin"] | ||
| ) | ||
| ], | ||
| targets: [ | ||
| // MARK: - C Library Target | ||
| .target( | ||
| name: "clibdogecoin", | ||
| path: ".", | ||
| exclude: [ | ||
| // Exclude CLI executables (but keep tool.c which has utility functions) | ||
| "src/cli/such.c", | ||
| "src/cli/sendtx.c", | ||
| "src/cli/spvnode.c", | ||
| // Exclude networking (requires libevent) - networking is done in Swift | ||
| "src/libevent", | ||
| "src/net.c", | ||
| "src/spv.c", | ||
| "src/rest.c", | ||
| "src/protocol.c", | ||
| "src/headersdb_file.c", | ||
| "src/headersdb.c", | ||
| // Exclude platform-specific code | ||
| "src/intel", | ||
| "src/openenclave", | ||
| "src/optee", | ||
| // Exclude benchmarks and tests | ||
| "src/bench.c", | ||
| "src/scrypt-sse2.c", | ||
| "test", | ||
| // Exclude secp256k1 files that are #included, not compiled separately | ||
| "src/secp256k1/src/tests.c", | ||
| "src/secp256k1/src/tests_exhaustive.c", | ||
| "src/secp256k1/src/bench.c", | ||
| "src/secp256k1/src/bench_ecmult.c", | ||
| "src/secp256k1/src/bench_internal.c", | ||
| "src/secp256k1/src/valgrind_ctime_test.c", | ||
| "src/secp256k1/src/precompute_ecmult.c", | ||
| "src/secp256k1/src/precompute_ecmult_gen.c", | ||
| // Exclude logdb tests | ||
| "src/logdb/test", | ||
| // Exclude documentation and examples | ||
| "doc", | ||
| "contrib", | ||
| "depends", | ||
| "Example", | ||
| // Exclude build artifacts and config | ||
| "config" | ||
| ], | ||
| sources: [ | ||
| // Core dogecoin sources | ||
| "src/address.c", | ||
| "src/aes.c", | ||
| "src/arith_uint256.c", | ||
| "src/auxpow.c", | ||
| "src/base58.c", | ||
| "src/bip32.c", | ||
| "src/bip39.c", | ||
| "src/bip44.c", | ||
| "src/block.c", | ||
| "src/buffer.c", | ||
| "src/chacha20.c", | ||
| "src/chainparams.c", | ||
| "src/cstr.c", | ||
| "src/ctaes.c", | ||
| "src/ecc.c", | ||
| "src/eckey.c", | ||
| "src/key.c", | ||
| "src/koinu.c", | ||
| "src/map.c", | ||
| "src/mem.c", | ||
| "src/moon.c", | ||
| "src/pow.c", | ||
| "src/png.c", | ||
| "src/jpeg.c", | ||
| "src/qr.c", | ||
| "src/qrengine.c", | ||
| "src/random.c", | ||
| "src/rmd160.c", | ||
| "src/script.c", | ||
| "src/scrypt.c", | ||
| "src/seal.c", | ||
| "src/serialize.c", | ||
| "src/sha2.c", | ||
| "src/sign.c", | ||
| "src/transaction.c", | ||
| "src/tx.c", | ||
| "src/utf8proc.c", | ||
| // Note: utf8proc_data.c is #included by utf8proc.c, not compiled separately | ||
| "src/utils.c", | ||
| "src/validation.c", | ||
| "src/vector.c", | ||
| "src/wallet.c", | ||
| // CLI tool utilities (not the executables) | ||
| "src/cli/tool.c", | ||
| // logdb sources | ||
| "src/logdb/logdb_core.c", | ||
| "src/logdb/logdb_memdb_llist.c", | ||
| "src/logdb/logdb_memdb_rbtree.c", | ||
| "src/logdb/logdb_rec.c", | ||
| "src/logdb/misc.c", | ||
| "src/logdb/red_black_tree.c", | ||
| "src/logdb/stack.c", | ||
| // secp256k1 - main library file (includes other .h implementations) | ||
| "src/secp256k1/src/secp256k1.c", | ||
| // secp256k1 - precomputed tables | ||
| "src/secp256k1/src/precomputed_ecmult.c", | ||
| "src/secp256k1/src/precomputed_ecmult_gen.c" | ||
| ], | ||
| publicHeadersPath: "include", | ||
| cSettings: [ | ||
| // Header search paths | ||
| .headerSearchPath("include"), | ||
| .headerSearchPath("src/secp256k1"), | ||
| .headerSearchPath("src/secp256k1/include"), | ||
| .headerSearchPath("src/secp256k1/src"), | ||
| .headerSearchPath("src/logdb/include"), | ||
|
|
||
| // secp256k1 configuration - 32-bit field/scalar for maximum compatibility | ||
| .define("USE_FIELD_10X26", to: "1"), | ||
| .define("USE_SCALAR_8X32", to: "1"), | ||
| .define("USE_FIELD_INV_BUILTIN", to: "1"), | ||
| .define("USE_SCALAR_INV_BUILTIN", to: "1"), | ||
| .define("ENABLE_MODULE_RECOVERY", to: "1"), | ||
| .define("ECMULT_WINDOW_SIZE", to: "15"), | ||
| .define("ECMULT_GEN_PREC_BITS", to: "4"), | ||
|
|
||
| // libdogecoin configuration | ||
| .define("RANDOM_DEVICE", to: "\"/dev/urandom\""), | ||
| .define("WITH_WALLET", to: "1"), | ||
| .define("WITH_LOGDB", to: "1"), | ||
| .define("PACKAGE_NAME", to: "\"libdogecoin\""), | ||
| .define("PACKAGE_VERSION", to: "\"0.1.5\""), | ||
|
|
||
| // Disable networking (we'll use Swift networking in DogecoinKit) | ||
| .define("WITH_NET", to: "0"), | ||
|
|
||
| // Suppress warnings for third-party code and undefine HAVE_CONFIG_H | ||
| .unsafeFlags([ | ||
| "-UHAVE_CONFIG_H", | ||
radmakr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "-Wno-shorten-64-to-32", | ||
| "-Wno-deprecated-non-prototype", | ||
| "-Wno-pointer-bool-conversion", | ||
| "-Wno-unused-function", | ||
| "-Wno-unused-variable" | ||
| ]) | ||
| ] | ||
| ) | ||
| ], | ||
| cLanguageStandard: .c99 | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| module clibdogecoin { | ||
| // libdogecoin.h is the unified API header that contains all public functions | ||
| // It already includes definitions from bip32, bip39, bip44, wallet, etc. | ||
| header "dogecoin/libdogecoin.h" | ||
|
|
||
| // BIP39 English wordlist for mnemonic validation and autocomplete | ||
| // This only contains a const char array, no typedef conflicts | ||
| header "bip39/english.h" | ||
|
|
||
| export * | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.