Переглянути джерело

One last structural change. Install header files to INSTALLDIR/usr/include
so we now parallel the behavior of the standard tools.

Also make sure we check INSTALLDIR/lib and INSTALLDIR/usr/lib for libraries.
-Erik

Eric Andersen 23 роки тому
батько
коміт
cebef70d90
7 змінених файлів з 63 додано та 59 видалено
  1. 9 9
      Makefile
  2. 3 1
      extra/gcc-uClibc/gcc-uClibc.c
  3. 0 1
      ldso/Rules.mak
  4. 2 8
      ldso/config.h
  5. 24 18
      ldso/ldso/dl-elf.c
  6. 24 18
      ldso/ldso/readelflib1.c
  7. 1 4
      ldso/util/ldconfig.c

+ 9 - 9
Makefile

@@ -154,17 +154,17 @@ install_runtime:
 # in $(INSTALL_DIR)/include.  Probably true only if you're using
 # a packaging system.
 install_dev:
-	install -d $(INSTALL_DIR)/include
-	install -d $(INSTALL_DIR)/include/bits
-	rm -f $(INSTALL_DIR)/include/asm
-	rm -f $(INSTALL_DIR)/include/linux
-	ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
-	ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
+	install -d $(INSTALL_DIR)/usr/include
+	install -d $(INSTALL_DIR)/usr/include/bits
+	rm -f $(INSTALL_DIR)/usr/include/asm
+	rm -f $(INSTALL_DIR)/usr/include/linux
+	ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/usr/include/asm
+	ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/usr/include/linux
 	find include/ -type f -depth -not -path "*CVS*" -exec install \
-	    -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
+	    -D -m 644 {} $(INSTALL_DIR)/usr/'{}' ';'
 	find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
-	    -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
-	install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
+	    -D -m 644 {} $(INSTALL_DIR)/usr/'{}' ';'
+	install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/usr/include/bits/
 	$(MAKE) -C extra/gcc-uClibc install
 
 clean:

+ 3 - 1
extra/gcc-uClibc/gcc-uClibc.c

@@ -63,7 +63,7 @@ static char *rpath[] = {
 };
 
 static char *uClibc_inc[] = {
-	"-I"UCLIBC_INSTALL_DIR"include/",
+	"-I"UCLIBC_INSTALL_DIR"usr/include/",
 	"-I"UCLIBC_BUILD_DIR"include/"
 };
 
@@ -74,7 +74,9 @@ static char *crt0_path[] = {
 
 static char *lib_path[] = {
 	"-L"UCLIBC_INSTALL_DIR"lib",
+	"-L"UCLIBC_INSTALL_DIR"usr/lib",
 	"-L"UCLIBC_BUILD_DIR"lib"
+	"-L"UCLIBC_BUILD_DIR"usr/lib"
 };
 
 static char static_linking[] = "-static";

+ 0 - 1
ldso/Rules.mak

@@ -10,5 +10,4 @@ CFLAGS	+= -DVERSION=\"$(LDSO_VERSION)\"
 CC = $(TOPDIR)extra/gcc-uClibc/$(NATIVE_ARCH)-uclibc-gcc
 ifeq ($(DEVEL),true)
 	CFLAGS += -DUCLIBC_INSTALL_DIR=\"$(INSTALL_DIR)\"
-	CFLAGS += -DUCLIBC_DEVEL
 endif

+ 2 - 8
ldso/config.h

@@ -4,18 +4,12 @@
 #  define LDSO_CACHE "../util/ld.so.cache"
 #  define LDSO_PRELOAD "../util/ld.so.preload"
 #  define LDDSTUB    "../util/lddstub"
-#elif UCLIBC_DEVEL
+#else
 #  define LDSO_IMAGE UCLIBC_INSTALL_DIR"/lib/ld.so"
 #  define LDSO_CONF  UCLIBC_INSTALL_DIR"/etc/ld.so.conf"
 #  define LDSO_CACHE UCLIBC_INSTALL_DIR"/etc/ld.so.cache"
 #  define LDSO_PRELOAD UCLIBC_INSTALL_DIR"/etc/ld.so.preload"
-#  define LDDSTUB    UCLIBC_INSTALL_DIR"/lib/lddstub"
-#else
-#  define LDSO_IMAGE "/lib/ld.so"
-#  define LDSO_CONF  "/etc/ld.so.conf"
-#  define LDSO_CACHE "/etc/ld.so.cache"
-#  define LDSO_PRELOAD "/etc/ld.so.preload"
-#  define LDDSTUB    "/usr/lib/lddstub"
+#  define LDDSTUB    UCLIBC_INSTALL_DIR"/usr/lib/lddstub"
 #endif
 
 #define LDD_ARGV0    "__LDD_ARGV0"

+ 24 - 18
ldso/ldso/dl-elf.c

@@ -227,7 +227,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	/*
 	 * Where should the cache be searched?  There is no such concept in the
 	 * ABI, so we have some flexibility here.  For now, search it before
-	 * the default path of /usr/lib.
+	 * the hard coded paths that follow (i.e before /lib and /usr/lib).
 	 */
 #ifdef USE_CACHE
 	if (_dl_cache_addr != NULL && _dl_cache_addr != (caddr_t) - 1) {
@@ -247,51 +247,57 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	}
 #endif
 
-
-#ifdef UCLIBC_DEVEL
-
-	/* Check in /usr/<arch>-linux-uclibc/lib */
-	pnt1 = UCLIBC_INSTALL_DIR "/lib";
+	/* Check in <install-dir>/usr/lib */
+	pnt1 = UCLIBC_INSTALL_DIR "/usr/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
+	    return tpnt1;
 
-#else /* UCLIBC_DEVEL */
+	/* Check in <install-dir>/lib */
+	pnt1 = UCLIBC_INSTALL_DIR "/lib/";
+	pnt = mylibname;
+	while (*pnt1)
+	    *pnt++ = *pnt1++;
+	pnt1 = libname;
+	while (*pnt1)
+	    *pnt++ = *pnt1++;
+	*pnt++ = 0;
+	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
+	if (tpnt1)
+	    return tpnt1;
 
 	/* Check in /usr/lib */
 	pnt1 = "/usr/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
+	    return tpnt1;
 
 	/* Check in /lib */
-	/* try "/lib/". */
 	pnt1 = "/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
-#endif /* UCLIBC_DEVEL */
+	    return tpnt1;
 
   goof:
 	/* Well, we shot our wad on that one.  All we can do now is punt */

+ 24 - 18
ldso/ldso/readelflib1.c

@@ -227,7 +227,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	/*
 	 * Where should the cache be searched?  There is no such concept in the
 	 * ABI, so we have some flexibility here.  For now, search it before
-	 * the default path of /usr/lib.
+	 * the hard coded paths that follow (i.e before /lib and /usr/lib).
 	 */
 #ifdef USE_CACHE
 	if (_dl_cache_addr != NULL && _dl_cache_addr != (caddr_t) - 1) {
@@ -247,51 +247,57 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	}
 #endif
 
-
-#ifdef UCLIBC_DEVEL
-
-	/* Check in /usr/<arch>-linux-uclibc/lib */
-	pnt1 = UCLIBC_INSTALL_DIR "/lib";
+	/* Check in <install-dir>/usr/lib */
+	pnt1 = UCLIBC_INSTALL_DIR "/usr/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
+	    return tpnt1;
 
-#else /* UCLIBC_DEVEL */
+	/* Check in <install-dir>/lib */
+	pnt1 = UCLIBC_INSTALL_DIR "/lib/";
+	pnt = mylibname;
+	while (*pnt1)
+	    *pnt++ = *pnt1++;
+	pnt1 = libname;
+	while (*pnt1)
+	    *pnt++ = *pnt1++;
+	*pnt++ = 0;
+	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
+	if (tpnt1)
+	    return tpnt1;
 
 	/* Check in /usr/lib */
 	pnt1 = "/usr/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
+	    return tpnt1;
 
 	/* Check in /lib */
-	/* try "/lib/". */
 	pnt1 = "/lib/";
 	pnt = mylibname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	pnt1 = libname;
 	while (*pnt1)
-		*pnt++ = *pnt1++;
+	    *pnt++ = *pnt1++;
 	*pnt++ = 0;
 	tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0);
 	if (tpnt1)
-		return tpnt1;
-#endif /* UCLIBC_DEVEL */
+	    return tpnt1;
 
   goof:
 	/* Well, we shot our wad on that one.  All we can do now is punt */

+ 1 - 4
ldso/util/ldconfig.c

@@ -684,13 +684,10 @@ int main(int argc, char **argv)
 		free(extpath);
 	    }
 
-#ifdef UCLIBC_DEVEL
+	    scan_dir(UCLIBC_INSTALL_DIR"/usr/lib");
 	    scan_dir(UCLIBC_INSTALL_DIR"/lib");
-#else
-	    /* everybody needs these, don't they? */
 	    scan_dir("/usr/lib");
 	    scan_dir("/lib");
-#endif
 	}
 
 	if (!nocache)