about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math/libamplsolver/libamplsolver-sharedlib.patch
blob: f2af2910e89c902ce668f07dc75e73e66810255f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Authors: Andrei Rozanski and Grace Dinh
Last-Update: 2022-08-23
Description: fix makefile.u in order to get libamplsover.so (Linux) or libamplsolver.dylib (Mac)

--- a/makefile.u
+++ b/makefile.u

@@ -26,8 +26,9 @@

 .SUFFIXES: .c .o
 CC = cc
-CFLAGS = -O
+CFLAGS := $(CFLAGS) -pipe -DASL_BUILD -fPIC -DPIC
 SHELL=/bin/sh
+OFILES=$(addsuffix .o,$(basename $(a)))

 # Add -DNO_RUSAGE to the CFLAGS assignment if your system
 # lacks getrusage().  This only matters for compiling xectim.c.
@@ -86,7 +87,7 @@
 .c.o:
 	$(CC) -c $(CFLAGS) $*.c

-all: arith.h stdio1.h amplsolver.a funcadd0.o
+all: arith.h stdio1.h amplsolver.a funcadd0.o libamplsolver@sharedlibext@

 a = \
 	asldate.c \
@@ -189,6 +190,11 @@
 # search path, e.g.
 #	exec true
 # or just comment out the ranlib invocation above.
+libamplsolver.so: $(OFILES)
+	$(CC) $^ -shared  -Wl,-soname,libamplsolver.so.0 $(LDFLAGS) -o $@.0
+	ln -s $@.0 $@
+libamplsolver.dylib: amplsolver.a
+	$(CC) -fpic -shared -Wl,-all_load amplsolver.a $(LDFLAGS) -o libamplsolver.dylib

 Aslh = arith.h asl.h funcadd.h stdio1.h
 auxinfo.o libnamsave.o: funcadd.h stdio1.h