nixpkgs/pkgs/by-name/li/libamplsolver/libamplsolver-sharedlib.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

39 lines
1.1 KiB
Diff

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