shithub: femtolisp

Download patch

ref: 83d3291c689d2599c80b372646bc102c8ddc779f
parent: 77b0f89b6685620ee0228db8154946203d1cce04
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Jan 16 13:12:29 EST 2025

mac builds: fix in a different way

Meson is choosing to enable PIC for static libraries by default,
which is the cause everything was broken on m68k builds.
Revert back to using static libraries but with disabled PIC.

--- a/meson.build
+++ b/meson.build
@@ -119,6 +119,15 @@
 	extras = []
 endif
 
+common = static_library(
+	'common',
+	sources: src_common,
+	include_directories: include_directories(
+		platform,
+	),
+	pic: false,
+)
+
 src_flisp = [
 	'3rd/fn.c',
 	'3rd/mt19937-64.c',
@@ -179,62 +188,82 @@
 	],
 )
 
-src_brieflz = [
-	'3rd/brieflz/brieflz.c',
-	'3rd/brieflz/depacks.c',
-]
+brieflz = static_library(
+	'brieflz',
+	sources: [
+		'3rd/brieflz/brieflz.c',
+		'3rd/brieflz/depacks.c',
+	],
+	include_directories: include_directories(
+		'3rd/brieflz',
+		platform,
+	),
+	pic: false,
+)
 
-src_mp = [
-	'3rd/mp/mpadd.c',
-	'3rd/mp/mpaux.c',
-	'3rd/mp/mpcmp.c',
-	'3rd/mp/mpdigdiv.c',
-	'3rd/mp/mpdiv.c',
-	'3rd/mp/mpexp.c',
-	'3rd/mp/mpextendedgcd.c',
-	'3rd/mp/mpfmt.c',
-	'3rd/mp/mpinvert.c',
-	'3rd/mp/mpleft.c',
-	'3rd/mp/mplogic.c',
-	'3rd/mp/mpmod.c',
-	'3rd/mp/mpmodop.c',
-	'3rd/mp/mpmul.c',
-	'3rd/mp/mprand.c',
-	'3rd/mp/mpright.c',
-	'3rd/mp/mpsub.c',
-	'3rd/mp/mptobe.c',
-	'3rd/mp/mptober.c',
-	'3rd/mp/mptod.c',
-	'3rd/mp/mptoi.c',
-	'3rd/mp/mptoui.c',
-	'3rd/mp/mptouv.c',
-	'3rd/mp/mptov.c',
-	'3rd/mp/mpvecadd.c',
-	'3rd/mp/mpveccmp.c',
-	'3rd/mp/mpvecdigmuladd.c',
-	'3rd/mp/mpvecsub.c',
-	'3rd/mp/mpvectscmp.c',
-	'3rd/mp/strtomp.c',
-	'3rd/mp/u16.c',
-]
+mp = static_library(
+	'mp',
+	sources: [
+		'3rd/mp/mpadd.c',
+		'3rd/mp/mpaux.c',
+		'3rd/mp/mpcmp.c',
+		'3rd/mp/mpdigdiv.c',
+		'3rd/mp/mpdiv.c',
+		'3rd/mp/mpexp.c',
+		'3rd/mp/mpextendedgcd.c',
+		'3rd/mp/mpfmt.c',
+		'3rd/mp/mpinvert.c',
+		'3rd/mp/mpleft.c',
+		'3rd/mp/mplogic.c',
+		'3rd/mp/mpmod.c',
+		'3rd/mp/mpmodop.c',
+		'3rd/mp/mpmul.c',
+		'3rd/mp/mprand.c',
+		'3rd/mp/mpright.c',
+		'3rd/mp/mpsub.c',
+		'3rd/mp/mptobe.c',
+		'3rd/mp/mptober.c',
+		'3rd/mp/mptod.c',
+		'3rd/mp/mptoi.c',
+		'3rd/mp/mptoui.c',
+		'3rd/mp/mptouv.c',
+		'3rd/mp/mptov.c',
+		'3rd/mp/mpvecadd.c',
+		'3rd/mp/mpveccmp.c',
+		'3rd/mp/mpvecdigmuladd.c',
+		'3rd/mp/mpvecsub.c',
+		'3rd/mp/mpvectscmp.c',
+		'3rd/mp/strtomp.c',
+		'3rd/mp/u16.c',
+	],
+	include_directories: include_directories(
+		'3rd/mp',
+		platform,
+	),
+	pic: false,
+)
 
-src_utf = [
-	'3rd/utf/rune.c',
-	'3rd/utf/runeistype.c',
-	'3rd/utf/runetotype.c',
-	'3rd/utf/utfnlen.c',
-]
+utf = static_library(
+	'utf',
+	sources: [
+		'3rd/utf/rune.c',
+		'3rd/utf/runeistype.c',
+		'3rd/utf/runetotype.c',
+		'3rd/utf/utfnlen.c',
+	],
+	include_directories: include_directories(
+		'3rd/utf',
+		platform,
+	),
+	pic: false,
+)
 
 flisp = executable(
 	flisp_exe_name,
 	sources: [
+		src_flisp,
 		boot,
 		builtins,
-		src_brieflz,
-		src_common,
-		src_flisp,
-		src_mp,
-		src_utf,
 	],
 	dependencies: [
 		math,
@@ -246,6 +275,12 @@
 		'3rd/utf',
 		platform,
 	),
+	link_with: [
+		brieflz,
+		common,
+		mp,
+		utf,
+	]
 )
 
 if platform == 'macos'
@@ -308,12 +343,14 @@
 		'mptest',
 		sources: [
 			'3rd/mp/test.c',
-			src_common,
-			src_mp,
 		],
 		include_directories: include_directories(
 			platform,
 		),
+		link_with: [
+			common,
+			mp,
+		],
 	)
 	test('mp', mptest)
 	mptest2 = executable(
@@ -323,8 +360,6 @@
 			'3rd/mp/test/gen.tab.c',
 			'3rd/mp/test/ld.c',
 			'3rd/mp/test/main.c',
-			src_common,
-			src_mp,
 		],
 		include_directories: include_directories(
 			'3rd/mp',
@@ -331,6 +366,10 @@
 			'3rd/mp/test',
 			platform,
 		),
+		link_with: [
+			common,
+			mp,
+		],
 	)
 	test('mp2', mptest2, timeout: -1)
 endif