From 3129d7168c1e91511f8f9505709f5f2defca9a5b Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Wed, 26 Jul 2023 08:41:30 +0800 Subject: [PATCH] Fix dynlibs build diff --git src/Makefile.inc src/Makefile.inc index 8ddfd24..683a150 100644 --- src/Makefile.inc +++ src/Makefile.inc @@ -15,6 +15,9 @@ INCDIR=${PREFIX}/include/mosml DOCDIR=${PREFIX}/share/doc/mosml TOOLDIR=${PREFIX}/bin +# This is not needed for the main port, only for dynlibs: +DESTDIR=@DESTDIR@ + ### Where to install the man pages # Man pages for commands go in $(MANDIR)/man$(MANEXT) MANDIR=${PREFIX}/man diff --git src/dynlibs/Makefile src/dynlibs/Makefile index 603d412..0f714d6 100644 --- src/dynlibs/Makefile +++ src/dynlibs/Makefile @@ -1,53 +1,36 @@ all: + cd crypt; make cd interface; make - cd intinf; make cd mgd; make cd mgdbm; make - cd mmysql; make cd mpq; make cd mregex; make - cd msocket; make - cd munix; make install: - cd intinf; make install + cd crypt; make install cd mgd; make install cd mgdbm; make install - cd mmysql; make install cd mpq; make install cd mregex; make install - cd msocket; make install - cd munix; make install uninstall: - cd intinf; make uninstall cd mgd; make uninstall cd mgdbm; make uninstall - cd mmysql; make uninstall cd mpq; make uninstall cd mregex; make uninstall - cd msocket; make uninstall - cd munix; make uninstall test: cd interface; make test - cd intinf; make test cd mgd; make test cd mgdbm; make test - cd mmysql; make test cd mpq; make test cd mregex; make test - cd munix; make test clean: cd crypt; make clean cd interface; make clean - cd intinf; make clean cd mgd; make clean cd mgdbm; make clean - cd mmysql; make clean cd mpq; make clean cd mregex; make clean - cd msocket; make clean - cd munix; make clean diff --git src/dynlibs/crypt/Makefile src/dynlibs/crypt/Makefile index 1fe1b52..5f2791b 100644 --- src/dynlibs/crypt/Makefile +++ src/dynlibs/crypt/Makefile @@ -6,15 +6,17 @@ OPTS=-fno-defer-pop CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) BASELIBS=-lm -ldl -all: libcrypt.so +all: libcrypt.so @echo "Now execute 'mosml crypt.sml' to test the C function" crypt.o: crypt.c $(CC) $(CFLAGS) -c -o crypt.o crypt.c libcrypt.so: crypt.o - $(DYNLD) -lcrypt -o libcrypt.so crypt.o -# $(DYNLD) -o libcrypt.so crypt.o + $(DYNLD) -lcrypto -o libcrypt.so crypt.o + +install: + ${INSTALL_DATA} libcrypt.so $(DESTDIR)$(LIBDIR) clean: rm -f *.o diff --git src/dynlibs/mgd/Makefile src/dynlibs/mgd/Makefile index 550326d..d265c36 100644 --- src/dynlibs/mgd/Makefile +++ src/dynlibs/mgd/Makefile @@ -5,14 +5,12 @@ # Where to find gd header file and compiled library -GDDIR=${HOME}/c/gd-1.7.3 - include ../../Makefile.inc OPTS=-fno-defer-pop -CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${GDDIR} +CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I${GDINCDIR} -MOSMLTOOLS=camlrunm $(MOSMLHOME)/tools +MOSMLTOOLS=@PREFIX@/bin/camlrunm $(TOOLDIR) MOSMLC=mosmlc -c MOSMLL=mosmlc MOSMLLEX=mosmllex @@ -24,15 +22,13 @@ mgd.o: mgd.c $(CC) $(CFLAGS) -c -o mgd.o mgd.c libmgd.so: mgd.o - $(DYNLD) -o libmgd.so mgd.o ${GDDIR}/libgd.a -L/usr/lib -lpng -lz -# $(DYNLD) -o libmgd.so mgd.o ${GDDIR}/libgd.a -L/usr/X11R6/lib -lpng -lz -# $(DYNLD) -o libmgd.so mgd.o ${GDDIR}/libgd.a -R/pack/libs/lib -L/pack/libs/lib -lpng -lz + $(DYNLD) -o libmgd.so mgd.o ${GDLIBDIR}/libgd.a -L@PREFIX@/lib -lpng -lz test: Graphs.uo mosml testgdimage.sml install: - ${INSTALL_DATA} libmgd.so $(LIBDIR) + ${INSTALL_DATA} libmgd.so $(DESTDIR)$(LIBDIR) uninstall: ${UNINSTALL_DATA} $(LIBDIR)/libmgd.so diff --git src/dynlibs/mgdbm/Makefile src/dynlibs/mgdbm/Makefile index 7218150..ff6627a 100644 --- src/dynlibs/mgdbm/Makefile +++ src/dynlibs/mgdbm/Makefile @@ -5,11 +5,6 @@ # Where to find GDBM header file and compiled library -GDBMLIBDIR=${HOME}/c/gdbm-1.7.3 -GDBMINCDIR=${HOME}/c/gdbm-1.7.3 -#GDBMLIBDIR=/usr/lib -#GDBMINCDIR=/usr/include - include ../../Makefile.inc OPTS=-fno-defer-pop @@ -19,7 +14,7 @@ BASELIBS=-lm -ldl all: libmgdbm.so install: - ${INSTALL_DATA} libmgdbm.so $(LIBDIR) + ${INSTALL_DATA} libmgdbm.so $(DESTDIR)$(LIBDIR) uninstall: ${UNINSTALL_DATA} $(LIBDIR)/libmgdbm.so diff --git src/dynlibs/mpq/Makefile src/dynlibs/mpq/Makefile index 8d8cec4..5cc0044 100644 --- src/dynlibs/mpq/Makefile +++ src/dynlibs/mpq/Makefile @@ -7,23 +7,15 @@ # Note: Unix distributions vary widely in the PGSQLLIBDIR # and PGSQLINCDIR locations -PGSQLLIBDIR=/usr/lib -PGSQLINCDIR=/usr/include/postgresql -#PGSQLLIBDIR=/usr/lib -#PGSQLINCDIR=/usr/include/pgsql -#PGSQLLIBDIR=/usr/local/pgsql/lib -#PGSQLINCDIR=/usr/local/pgsql/include -#PGSQLLIBDIR=/usr/lib/pgsql/lib -#PGSQLINCDIR=/usr/lib/pgsql/include -#PGSQLLIBDIR=/pack/postgresql/lib -#PGSQLINCDIR=/pack/postgresql/include +PGSQLLIBDIR=@PREFIX@/lib/@PGSQL@ +PGSQLINCDIR=@PREFIX@/include/@PGSQL@ include ../../Makefile.inc OPTS=-fno-defer-pop CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${PGSQLINCDIR} -MOSMLTOOLS=camlrunm $(MOSMLHOME)/tools +MOSMLTOOLS=@PREFIX@/bin/camlrunm $(TOOLDIR) MOSMLC=mosmlc -c MOSMLL=mosmlc MOSMLLEX=mosmllex @@ -36,11 +28,11 @@ mpq.o: mpq.c libmpq.so: mpq.o # Some recent Linux distributions need this: - $(DYNLD) -lcrypt -o libmpq.so mpq.o ${PGSQLLIBDIR}/libpq.a + $(DYNLD) -lcrypto -o libmpq.so mpq.o ${PGSQLLIBDIR}/libpq.a # $(DYNLD) -o libmpq.so mpq.o ${PGSQLLIBDIR}/libpq.a install: - ${INSTALL_DATA} libmpq.so $(LIBDIR) + ${INSTALL_DATA} libmpq.so $(DESTDIR)$(LIBDIR) uninstall: ${UNINSTALL_DATA} $(LIBDIR)/libmpq.so diff --git src/dynlibs/mregex/Makefile src/dynlibs/mregex/Makefile index 2fd659b..04660c1 100644 --- src/dynlibs/mregex/Makefile +++ src/dynlibs/mregex/Makefile @@ -8,7 +8,7 @@ include ../../Makefile.inc OPTS=-fno-defer-pop CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -MOSMLTOOLS=camlrunm $(MOSMLHOME)/tools +MOSMLTOOLS=@PREFIX@/bin/camlrunm $(TOOLDIR) MOSMLC=mosmlc -c MOSMLL=mosmlc MOSMLLEX=mosmllex @@ -24,7 +24,7 @@ libmregex.so: mregex.o $(DYNLD) -o libmregex.so regex-0.12/regex.o mregex.o install: - ${INSTALL_DATA} libmregex.so $(LIBDIR) + ${INSTALL_DATA} libmregex.so $(DESTDIR)$(LIBDIR) uninstall: ${UNINSTALL_DATA} $(LIBDIR)/libmregex.so