Hi Jasem,
This is great!
I'm just reviewing the patch and have a few comments/questions:
```
Index: gsl-an/Makefile
===================================================================
--- gsl-an/Makefile (revision 23745)
+++ gsl-an/Makefile (working copy)
@@ -175,6 +175,7 @@
# "sort" removes duplicates.
GSL_OBJS := $(sort $(QR_OBJS) $(CHOL_OBJS) $(SVD_OBJS) $(LU_OBJS) $(EXTRA_OBJS))
+GSL_LIBS := -lm
$(GSL_OBJS): config.h
```
I don't think that does anything... the variable GSL_LIBS does not appear anywhere else that I can see. Were you trying to add a "-lm" everywhere the GSL library is linked? If so, that should go in util/makefile.gsl .
But easier would be to add a line like,
LDLIBS := $(LDLIBS_DEF)
LDLIBS += -lm
like in blind/Makefile, to the other directories that link executables. I see util/ already has one, so I'm not sure what else is required.
```
Index: catalogs/Makefile
===================================================================
--- catalogs/Makefile (revision 23745)
+++ catalogs/Makefile (working copy)
@@ -89,6 +89,7 @@
all: ngc2000.py $(LIBCAT)
+PY_INSTALL_DIR := $(PY_BASE_INSTALL_DIR)/util
install: $(PYTHON_INSTALL) $(LIBCAT) $(HEADERS)
@echo Installing in base directory '$(INSTALL_DIR)'
mkdir -p '$(PY_INSTALL_DIR)'
```
No, PY_INSTALL_DIR is defined earlier in that file,
PY_INSTALL_DIR := $(PY_BASE_INSTALL_DIR)/catalogs
```
Index: libkd/Makefile
===================================================================
--- libkd/Makefile (revision 23745)
+++ libkd/Makefile (working copy)
@@ -146,7 +146,7 @@
ALL_TEST_FILES = test_libkd test_libkd_io test_dualtree_nn
ALL_TEST_EXTRA_OBJS =
-ALL_TEST_LIBS = $(LIBKD) $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB)
+ALL_TEST_LIBS = $(LIBKD) $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB) -lm
include $(COMMON)/makefile.tests
```
Only problem is, in util/makefile.tests, ALL_TEST_LIBS is used like this,
```
test: test.o $(COMMON)/cutest.o $(ALL_TEST_FILES_O) $(sort $(ALL_TEST_EXTRA_OBJS)) $(ALL_TEST_LIBS)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(ALL_TEST_EXTRA_LDFLAGS)
```
so I think you should add "-lm" to ALL_TEST_EXTRA_LDFLAGS instead.
```
Index: blind/Makefile
===================================================================
--- blind/Makefile (revision 23745)
+++ blind/Makefile (working copy)
@@ -214,6 +214,7 @@
PYTHON_EXECS := plotann.py
PYTHON_INSTALL := $(PYTHON_EXECS) __init__.py
+CONF_BASE_DIR := $(INSTALL_DIR)
install: $(INSTALL_EXECS) $(INSTALL_LIB)
@echo Installing in directory '$(INSTALL_DIR)'
@@ -223,8 +224,7 @@
cp $$x '$(INSTALL_DIR)/bin'; \
done
mkdir -p '$(INSTALL_DIR)/etc'
-
- python -c "import os; print open('../etc/backend.cfg-dist').read().replace('INSTALL_DIR', os.environ['INSTALL_DIR'])" > '$(INSTALL_DIR)/etc/backend.cfg'
+ python -c "import os; print open('../etc/backend.cfg-dist').read().replace('INSTALL_DIR', '$(CONF_BASE_DIR)')" > '$(INSTALL_DIR)/etc/backend.cfg'
mkdir -p '$(INSTALL_DIR)/include'
@for x in $(INSTALL_H); do \
echo cp $$x '$(INSTALL_DIR)/include'; \
```
Could you explain what the issue was here? What was wrong with using os.environ?
OHHHH, good catch!, I see that I recently commented-out the link "export INSTALL_DIR", which asks Make to put that variable in the environment when it runs recipes. I just reverted that change. With that fixed, I think the CONF_BASE_DIR shouldn't be necessary. But maybe you needed that for some other reason?
```
Index: util/makefile.common
===================================================================
--- util/makefile.common (revision 23745)
+++ util/makefile.common (working copy)
@@ -16,7 +16,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-INSTALL_DIR ?= /usr/local/astrometry
+DESTDIR ?= /usr/local/astrometry
+INSTALL_DIR = $(DESTDIR)
#export INSTALL_DIR
# Installation subdirs
```
Is there a way to make it so that INSTALL_DIR, if specified on the command line, it is used, and likewise, if DESTDIR is specified, it is used? Maybe something like,
```
INSTALL_DIR ?= /usr/local/astrometry
DESTDIR ?= $(INSTALL_DIR)
```
I just want this for the selfish reason that I will still think it's called INSTALL_DIR :) And other packagers may use INSTALL_DIR (eg, the Homebrew installer on Mac does this), and I would like it if existing documentation (little though it is) remains valid.
```
Index: util/Makefile
===================================================================
--- util/Makefile (revision 23745)
+++ util/Makefile (working copy)
@@ -313,10 +313,10 @@
echo cp $$x '$(LIB_INSTALL_DIR)/'$$x; \
cp $$x '$(LIB_INSTALL_DIR)/'$$x; \
done
- @echo "The following copy commands may fail; they are optional."
- -cp _util.so '$(PY_INSTALL_DIR)'
- -cp util.py '$(PY_INSTALL_DIR)'
- @echo ok
+ #@echo "The following copy commands may fail; they are optional."
+ #-cp _util.so '$(PY_INSTALL_DIR)'
+ #-cp util.py '$(PY_INSTALL_DIR)'
+ #@echo ok
.PHONY: install
```
Don't remove that, please. Those are the python bindings for the C code -- not used by the core Astrometry.net code, I don't think, but used by other projects. In debian/ubuntu they won't be an issue to build and I would very much appreciate them being installed.
```
@@ -478,7 +478,7 @@
test_dfind test_ctmf test_dsmooth test_dcen3x3 test_simplexy
# test_hd depends on hd.fits...
ALL_TEST_EXTRA_OBJS =
-ALL_TEST_LIBS = $(LIBKD_LIB) $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB) $(GSL_LIB)
+ALL_TEST_LIBS = $(ANFILES_LIB) $(ANUTILS_LIB) $(QFITS_LIB) $(GSL_LIB) $(LIBKD_LIB) -lm
ALL_TEST_EXTRA_LDFLAGS = $(WCSLIB_LIB)
include $(COMMON)/makefile.tests
```
Be careful with the order of libraries. Some recent compilers are very fussy that the libraries are listed in dependency order. The dependency structure in the Astrometry.net libraries is nutty -- if I recall correctly it's ANFILES -> LIBKD -> ANUTILS -> QFITS, GSL
Are you actually going to build and run the tests in the debian package?
Sorry for nit-picking! Thanks very much again for this patch,
--dustin