$NetBSD: patch-Makefile.in,v 1.3 2025/05/06 20:35:02 vins Exp $ * Libtoolized * Use pkgsrc-defined python version --- Makefile.in.orig 2025-03-10 13:29:06.000000000 +0000 +++ Makefile.in @@ -2,7 +2,6 @@ LIBS = -lslang @LIBS@ LIBTCL = @TCL_LIB_FLAG@ CC = @CC@ -CPP = @CPP@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@ @@ -16,7 +15,7 @@ SOEXT = so PYTHONVERS = @PYTHONVERS@ WHIPTCLLIB = @WHIPTCLLIB@ ifneq ($(WHIPTCLLIB),) -WHIPTCLSO = $(WHIPTCLLIB).$(SOEXT) +WHIPTCLSO = $(WHIPTCLLIB).la else WHIPTCLSO = endif @@ -25,18 +24,12 @@ PROGS = test whiptail $(WHIPTCLSO) testg TESTOBJS = test.o testgrid.o testtree.o showchars.o showkey.o NDIALOGOBJS = whiptail.o dialogboxes.o WHIPTCLOBJS = shared/whiptcl.o shared/dialogboxes.o -LIBNEWT = libnewt.a -LIBNEWTSH = libnewt.$(SOEXT).$(VERSION) -LIBNEWTSONAME = libnewt.$(SOEXT).$(SONAME) +LIBNEWT = libnewt.la LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \ scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o \ checkboxtree.o -ifneq ($(GNU_LD),) -SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver -Wl,-soname,$(LIBNEWTSONAME) -else -SHLIBFLAGS= -endif +SHLIBFLAGS= -shared SHCFLAGS = -fPIC @@ -56,6 +49,10 @@ instroot ?= $(DESTDIR) SOURCES = $(subst .o,.c,$(TESTOBJS) $(NDIALOGOBJS) $(LIBOBJS)) +NDIALOGLOBJS = $(subst .o,.lo, $(NDIALOGOBJS)) +WHIPTCLLOBJS = $(subst .o,.lo,$(WHIPTCLOBJS)) +LIBLOBJS = $(subst .o,.lo, $(LIBOBJS)) + SHAREDDIR = shared SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS)) @@ -65,82 +62,83 @@ else TARGET=depend $(PROGS) endif -all: $(TARGET) _snack.$(SOEXT) +all: $(TARGET) _snack.la test: test.o $(LIBNEWT) - $(CC) -g -o test test.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o test test.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + testgrid: testgrid.o $(LIBNEWT) - $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LDFLAGS) $(LIBS) testtree: testtree.o $(LIBNEWT) - $(CC) -g -o testtree testtree.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o testtree testtree.o $(LIBNEWT) $(LDFLAGS) $(LIBS) showchars: showchars.o $(LIBNEWT) - $(CC) -g -o showchars showchars.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o showchars showchars.o $(LIBNEWT) $(LDFLAGS) $(LIBS) showkey: showkey.o $(LIBNEWT) - $(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS) -_snack.$(SOEXT): snack.c $(LIBNEWTSH) +_snack.la: snack.c $(LIBNEWT) ifneq ($(PYTHONVERS),) @for ver in $(PYTHONVERS); do \ - pyconfig=$$ver-config; \ + pyconfig=python$$ver-config; \ if ! $$pyconfig --cflags > /dev/null 2>&1 && \ python-config --cflags > /dev/null 2>&1; then \ echo $$pyconfig not found, using python-config; \ pyconfig=python-config; \ fi; \ - mkdir -p $$ver; \ + mkdir -p python$$ver; \ PCFLAGS=`$$pyconfig --cflags`; \ PLDFLAGS=`$$pyconfig --ldflags --embed || $$pyconfig --ldflags`; \ - echo $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \ - $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PCFLAGS -c -o $$ver/snack.o snack.c; \ - echo $(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \ - $(CC) --shared $(LDFLAGS) $$PLDFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \ + ${LIBTOOL} --mode=compile --tag=CC $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o python$$ver/snack.lo snack.c; \ + ${LIBTOOL} --mode=link --tag=CC $(CC) -module -shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o python$$ver/_snack.la python$$ver/snack.lo libnewt.la $(LIBS) -rpath ${PREFIX}/lib/python$$ver/site-packages ; \ done endif touch $@ -whiptail: $(NDIALOGOBJS) $(LIBNEWTSH) - $(CC) -g -o whiptail $(NDIALOGOBJS) -L. $(LDFLAGS) -lnewt $(LIBS) -lpopt +whiptail: $(NDIALOGLOBJS) $(LIBNEWT) + ${LIBTOOL} --mode=link --tag=CC $(CC) -g -o whiptail $(NDIALOGLOBJS) $(LDFLAGS) libnewt.la $(LIBS) -lpopt -whiptcl.$(SOEXT): $(WHIPTCLOBJS) $(LIBNEWTSH) - $(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.$(SOEXT) $(WHIPTCLOBJS) -L. -lnewt $(LIBTCL) -lpopt $(LIBS) +whiptcl.la: $(WHIPTCLLOBJS) $(LIBNEWT) + ${LIBTOOL} --mode=link --tag=CC $(CC) -module -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.la $(WHIPTCLLOBJS) libnewt.la $(LIBTCL) -lpopt $(LIBS) -rpath ${PREFIX}/lib -$(LIBNEWT): $(LIBOBJS) - ar rv $@ $^ +$(LIBNEWT): $(LIBLOBJS) + ${LIBTOOL} --mode=link --tag=CC \ + ${CC} -o $@ \ + ${LIBLOBJS} \ + -rpath ${PREFIX}/lib \ + -version-info 0:52 -newt.o $(SHAREDDIR)/newt.o: newt.c Makefile +newt.lo $(SHAREDDIR)/newt.lo: newt.c Makefile veryclean: clean rm -f .depend *.pc clean: - rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWTSH) \ + rm -f $(PROGS) *.o $(LIBNEWT) core $(LIBNEWT) \ $(SHAREDDIR)/*.o *.$(SOEXT)* depend: $(CC) $(CFLAGS) $(CPPFLAGS) -M $(SOURCES) > .depend -sharedlib: $(LIBNEWTSH) +sharedlib: $(LIBNEWT) -$(LIBNEWTSH): $(SHAREDOBJS) - $(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) $(SHAREDOBJS) $(LDFLAGS) $(LIBS) - ln -fs $(LIBNEWTSONAME) libnewt.$(SOEXT) - ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME) +%.lo : %.c + ${LIBTOOL} --mode=compile --tag=CC $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< -$(SHAREDDIR)/%.o : %.c +$(SHAREDDIR)/%.lo : %.c @mkdir -p $(SHAREDDIR) - $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< + ${LIBTOOL} --mode=compile --tag=CC $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< + install: $(LIBNEWT) install-sh whiptail [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir) [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir) [ -d $(instroot)/$(man1dir) ] || install -m 755 -d $(instroot)/$(man1dir) - install -m 644 $(LIBNEWT) $(instroot)/$(libdir) - install -m 755 whiptail $(instroot)/$(bindir) - install -m 644 whiptail.1 $(instroot)/$(man1dir) + ${LIBTOOL} --mode=install install -m 755 whiptail $(instroot)/$(bindir) + ${LIBTOOL} --mode=install install -m 644 whiptail.1 $(instroot)/$(man1dir) make -C po datadir=$(instroot)/$(datadir) install install-sh: sharedlib install-tcl install-py @@ -148,28 +146,21 @@ install-sh: sharedlib install-tcl instal [ -d $(instroot)/$(includedir) ] || install -m 755 -d $(instroot)/$(includedir) [ -d $(instroot)/$(pkgconfigdir) ] || install -m 755 -d $(instroot)/$(pkgconfigdir) install -m 644 newt.h $(instroot)/$(includedir) - install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir) - ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.$(SOEXT) - ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME) + ${LIBTOOL} --mode=install install -m 755 $(LIBNEWT) $(instroot)/$(libdir) install -m 644 libnewt.pc $(instroot)/$(pkgconfigdir) install-tcl: $(WHIPTCLSO) ifneq ($(WHIPTCLSO),) [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir) - install -m 755 $(WHIPTCLSO) $(instroot)/$(libdir) + ${LIBTOOL} --mode=install install -m 755 whiptcl.la $(instroot)/$(libdir) endif -install-py: _snack.$(SOEXT) -ifneq ($(PYTHONVERS),) - @for ver in $(PYTHONVERS); do \ - PLATLIB=`$$ver -c "import sysconfig; print(sysconfig.get_path('platlib'))"`; \ - [ -d $(instroot)/$$PLATLIB ] || install -m 755 -d $(instroot)/$$PLATLIB ;\ - echo install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\ - install -m 755 $$ver/_snack.$(SOEXT) $(instroot)/$$PLATLIB;\ - echo install -m 644 snack.py $(instroot)/$$PLATLIB;\ - install -m 644 snack.py $(instroot)/$$PLATLIB;\ +install-py: _snack.la + [ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \ + [ -d $(instroot)/$(libdir)/python$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/python$$ver/site-packages ;\ + ${LIBTOOL} --mode=install install -m 755 python$$ver/_snack.la $(instroot)/$(libdir)/python$$ver/site-packages ;\ + install -m 644 snack.py $(instroot)/$(libdir)/python$$ver/site-packages ;\ done -endif Makefile: configure.ac @echo "You need to rerun ./autogen.sh and ./configure before continuing"