[R] source package build/installation with subdirectory-lib

Murat Tasan mmuurr at gmail.com
Tue Oct 5 00:02:13 CEST 2010


so i've narrowed it down to a case that works, and one that doesn't
(but i think should?)
here's the working Makevars file (copied directly):

------------------ WORKING EXAMPLE ------------------------

JANSSON_DIR = $(PWD)/jansson-1.3
JANSSON_LIB_DIR = $(PWD)/jansson-1.3/lib
JANSSON_INCLUDE_DIR = $(PWD)/jansson-1.3/include
JANSSON_LIB = -ljansson

PKG_CPPFLAGS = -I$(JANSSON_INCLUDE_DIR)
PKG_LIBS = -L$(JANSSON_LIB_DIR) $(JANSSON_LIB)

.PHONY: all jansson_target

all: jansson_target $(SHLIB)

$(SHLIB): jansson_target

jansson_target:
        (echo 'foobar!'; cd .; gunzip jansson-1.3.tar.gz; tar -xf
jansson-1.3.tar; cd jansson-1.3; ./configure --prefix=$(JANSSON_DIR) --
with-pic --disable-sh\
ared; make; make install)


and here's a non-working example.  the only changed line is the all
target/dependencies line:

------------------ NON-WORKING EXAMPLE ------------------------


JANSSON_DIR = $(PWD)/jansson-1.3
JANSSON_LIB_DIR = $(PWD)/jansson-1.3/lib
JANSSON_INCLUDE_DIR = $(PWD)/jansson-1.3/include
JANSSON_LIB = -ljansson

PKG_CPPFLAGS = -I$(JANSSON_INCLUDE_DIR)
PKG_LIBS = -L$(JANSSON_LIB_DIR) $(JANSSON_LIB)

.PHONY: all jansson_target

all: $(SHLIB)

$(SHLIB): jansson_target

jansson_target:
        (echo 'foobar!'; cd .; gunzip jansson-1.3.tar.gz; tar -xf
jansson-1.3.tar; cd jansson-1.3; ./configure --prefix=$(JANSSON_DIR) --
with-pic --disable-sh\
ared; make; make install)



could someone try to explain to me why the first version works, but
the second doesn't?
also, if the dependencies for 'all' are reversed in order on that
single line in the working file, it stops working again.
in all non-working cases, R CMD INSTALL tries to build the target $
(SHLIB) (via the R CMD SHLIB command) *prior* to building the
dependency 'jansson_target'.

thanks for any insight into this... (it's working now, but i'm afraid
it's likely fragile).

-murat



More information about the R-help mailing list