@@ -781,6 +781,22 @@ fn (mut b Builder) ensure_linuxroot_exists(sysroot string) {
781
781
}
782
782
}
783
783
784
+ fn (mut b Builder) ensure_freebsdroot_exists (sysroot string ) {
785
+ crossrepo_url := 'https://github.com/spytheman/freebsd_base13.2'
786
+ sysroot_git_config_path := os.join_path (sysroot, '.git' , 'config' )
787
+ if os.is_dir (sysroot) && ! os.exists (sysroot_git_config_path) {
788
+ // remove existing obsolete unarchived .zip file content
789
+ os.rmdir_all (sysroot) or {}
790
+ }
791
+ if ! os.is_dir (sysroot) {
792
+ println ('Downloading files for FreeBSD cross compilation (~458MB) ...' )
793
+ os.system ('git clone ${crossrepo_url} ${sysroot} ' )
794
+ if ! os.exists (sysroot_git_config_path) {
795
+ verror ('Failed to clone `${crossrepo_url} ` to `${sysroot} `' )
796
+ }
797
+ }
798
+ }
799
+
784
800
fn (mut b Builder) cc_linux_cross () {
785
801
b.setup_ccompiler_options (b.pref.ccompiler)
786
802
b.build_thirdparty_obj_files ()
@@ -857,10 +873,8 @@ fn (mut b Builder) cc_freebsd_cross() {
857
873
if ! os.exists (parent_dir) {
858
874
os.mkdir (parent_dir) or { panic (err) }
859
875
}
860
- // Download from:
861
- // http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.2-RELEASE/base.txz
862
- sysroot := '/tmp/base13.2' // os.join_path(os.vmodules_dir(), 'freebsdroot')
863
- // b.ensure_linuxroot_exists(sysroot)
876
+ sysroot := os.join_path (os.vmodules_dir (), 'freebsdroot' )
877
+ b.ensure_freebsdroot_exists (sysroot)
864
878
obj_file := b.out_name_c + '.o'
865
879
cflags := b.get_os_cflags ()
866
880
defines , others , libs := cflags.defines_others_libs ()
0 commit comments