Last active
April 20, 2021 23:55
-
-
Save Wevah/2188ee165aa9edee22f5e100d1523021 to your computer and use it in GitHub Desktop.
Build an SQLite dylib from an amalgamation directory, automatically parsing out the version
This file contains 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
#!/usr/bin/env perl | |
# Run from inside an SQLite amalgamation directory | |
# (i.e., extracted from an amalgamation archive). | |
use warnings; | |
use strict; | |
use Cwd; | |
my $macosxminversion = "10.12"; | |
my ($dir) = getcwd() =~ m#([^/]+)$#; | |
if (my ($major, $minor, $patch) = $dir =~ m#sqlite-amalgamation-(\d)(\d{2})(\d{2})#) { | |
$major = int($major); | |
$minor = int($minor); | |
$patch = int($patch); | |
my $version = "$major.$minor.$patch"; | |
print "SQLite version $version\n"; | |
my @args = ('clang', '-dynamiclib', '-Os', | |
'-arch', 'x86_64', | |
'-arch', 'arm64', | |
"-Wl,-install_name,\@rpath/libsqlite3.dylib,-current_version,$version,-compatibility_version,$major", | |
"-mmacosx-version-min=$macosxminversion", | |
'-o', 'libsqlite3.dylib', | |
'sqlite3.c'); | |
system(@args); | |
} else { | |
print qq("$dir" is not an SQLite amalgamation directory.\n) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment