Commit bf37dc9c authored by Mike Frysinger's avatar Mike Frysinger
Browse files

grab some fixes from Gentoo to enable shared library support, add a...

grab some fixes from Gentoo to enable shared library support, add a jpeg-dirclean target, and cleanup the build in general
parent 6139aa18
Loading
Loading
Loading
Loading
+99 −0
Original line number Diff line number Diff line
- Respect options from configure (bindir/libdir/etc...)
- Grab AR from the env instead of hardcoding to 'ar'
- Fix install to respect $(DESTDIR)
- Also install jpegint.h #64254

--- jpeg/makefile.cfg
+++ jpeg/makefile.cfg
@@ -11,13 +11,13 @@
 # Where to install the programs and man pages.
 prefix = @prefix@
 exec_prefix = @exec_prefix@
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
-includedir = $(prefix)/include
+bindir = @bindir@
+libdir = @libdir@
+includedir = @includedir@
 binprefix =
 manprefix =
 manext = 1
-mandir = $(prefix)/man/man$(manext)
+mandir = @mandir@/man$(manext)
 
 # The name of your C compiler:
 CC= @CC@
@@ -60,7 +60,8 @@
 # directory creation command
 MKDIR= mkdir
 # library (.a) file creation command
-AR= ar rc
+AR = @AR@
+ARFLAGS = rc
 # second step in .a creation (use "touch" if not needed)
 AR2= @RANLIB@
 # installation program
@@ -163,7 +164,7 @@
 # without libtool:
 libjpeg.a: @A2K_DEPS@ $(LIBOBJECTS)
 	$(RM) libjpeg.a
-	$(AR) libjpeg.a  $(LIBOBJECTS)
+	$(AR) $(ARFLAGS) libjpeg.a  $(LIBOBJECTS)
 	$(AR2) libjpeg.a
 
 # with libtool:
@@ -191,25 +191,29 @@
 # Installation rules:
 
 install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom @FORCE_INSTALL_LIB@
-	$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
-	$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
-	$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
-	$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
-	$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
-	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
-	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
-	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
-	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
-	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
+	mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
+	$(INSTALL_PROGRAM) cjpeg $(DESTDIR)$(bindir)/$(binprefix)cjpeg
+	$(INSTALL_PROGRAM) djpeg $(DESTDIR)$(bindir)/$(binprefix)djpeg
+	$(INSTALL_PROGRAM) jpegtran $(DESTDIR)$(bindir)/$(binprefix)jpegtran
+	$(INSTALL_PROGRAM) rdjpgcom $(DESTDIR)$(bindir)/$(binprefix)rdjpgcom
+	$(INSTALL_PROGRAM) wrjpgcom $(DESTDIR)$(bindir)/$(binprefix)wrjpgcom
+	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(DESTDIR)$(mandir)/$(manprefix)cjpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(DESTDIR)$(mandir)/$(manprefix)djpeg.$(manext)
+	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(DESTDIR)$(mandir)/$(manprefix)jpegtran.$(manext)
+	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(DESTDIR)$(mandir)/$(manprefix)rdjpgcom.$(manext)
+	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(DESTDIR)$(mandir)/$(manprefix)wrjpgcom.$(manext)
 
 install-lib: libjpeg.$(A) install-headers
-	$(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)
+	mkdir -p $(DESTDIR)$(libdir)
+	$(INSTALL_LIB) libjpeg.$(A) $(DESTDIR)$(libdir)/$(binprefix)libjpeg.$(A)
 
 install-headers: jconfig.h
-	$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
-	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
-	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
-	$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
+	mkdir -p $(DESTDIR)$(includedir)
+	$(INSTALL_DATA) jconfig.h $(DESTDIR)$(includedir)/jconfig.h
+	$(INSTALL_DATA) $(srcdir)/jpegint.h $(DESTDIR)$(includedir)/jpegint.h
+	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(DESTDIR)$(includedir)/jpeglib.h
+	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(DESTDIR)$(includedir)/jmorecfg.h
+	$(INSTALL_DATA) $(srcdir)/jerror.h $(DESTDIR)$(includedir)/jerror.h
 
 clean:
 	$(RM) *.o *.lo libjpeg.a libjpeg.la
--- jpeg/configure
+++ jpeg/configure
@@ -1777,6 +1777,7 @@
 s%@CPP@%$CPP%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@AR@%${AR-ar}%g
 s%@RANLIB@%$RANLIB%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@O@%$O%g
+66 −0
Original line number Diff line number Diff line
--- jpeg/configure
+++ jpeg/configure
@@ -1559,7 +1559,7 @@
   if test "x$LTSTATIC" = xno; then
     disable_static="--disable-static"
   fi
-  $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh
+  $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh $CHOST
 fi
 
 # Select memory manager depending on user input.
--- jpeg/ltconfig
+++ jpeg/ltconfig
@@ -299,6 +299,7 @@
 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
 case "$host_os" in
 linux-gnu*) ;;
+linux-uclibc*) ;;
 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
 esac
 
@@ -553,7 +553,9 @@
     # On HP-UX, both CC and GCC only warn that PIC is supported... then they
     # create non-PIC objects.  So, if there were any warnings, we assume that
     # PIC is not supported.
+    # Make sure we only test warnings on HP-UX (pic_flag == +Z) or we can
+    # easily break Linux builds http://bugs.gentoo.org/70947
-    if test -s conftest.err; then
+    if test -s conftest.err -a "$pic_flag" = "+Z"; then
       echo "$ac_t"no 1>&6
       can_build_shared=no
       pic_flag=
@@ -1210,7 +1210,6 @@
   else
     # Only the GNU ld.so supports shared libraries on MkLinux.
     case "$host_cpu" in
-    powerpc*) dynamic_linker=no ;;
     *) dynamic_linker='Linux ld.so' ;;
     esac
   fi
@@ -1259,6 +1260,25 @@
   fi
   ;;
 
+linux-uclibc*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
+  soname_spec='${libname}${release}.so.$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  deplibs_check_method=pass_all
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  # Note: copied from linux-gnu, and may not be appropriate.
+  hardcode_into_libs=yes
+  # Assume using the uClibc dynamic linker.
+  dynamic_linker="uClibc ld.so"
+  ;;
+
 netbsd* | openbsd*)
   version_type=sunos
   library_names_spec='${libname}${release}.so.$versuffix'
+10 −12
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ jpeg-source: $(DL_DIR)/$(JPEG_SOURCE)

$(JPEG_DIR)/.unpacked: $(DL_DIR)/$(JPEG_SOURCE)
	$(JPEG_CAT) $(DL_DIR)/$(JPEG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(JPEG_DIR) package/jpeg/ jpeg\*.patch
	$(CONFIG_UPDATE) $(JPEG_DIR)
	touch $(JPEG_DIR)/.unpacked

@@ -42,17 +43,9 @@ $(JPEG_DIR)/.configured: $(JPEG_DIR)/.unpacked
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--prefix=$(STAGING_DIR) \
		--enable-shared \
		--enable-static \
	);
	touch $(JPEG_DIR)/.configured

@@ -61,7 +54,8 @@ $(JPEG_DIR)/.libs/libjpeg.a: $(JPEG_DIR)/.configured
	touch -c $(JPEG_DIR)/.libs/libjpeg.a

$(STAGING_DIR)/lib/libjpeg.a: $(JPEG_DIR)/.libs/libjpeg.a
	$(MAKE) -C $(JPEG_DIR) prefix=$(STAGING_DIR) exec_prefix=$(STAGING_DIR) install-headers install-lib
	$(MAKE) -C $(JPEG_DIR) install-headers install-lib
	rm $(STAGING_DIR)/lib/libjpeg.la
	touch -c $(STAGING_DIR)/lib/libjpeg.a

$(TARGET_DIR)/usr/lib/libjpeg.a: $(STAGING_DIR)/lib/libjpeg.a
@@ -73,6 +67,10 @@ jpeg: uclibc $(TARGET_DIR)/usr/lib/libjpeg.a

jpeg-clean:
	-$(MAKE) -C $(JPEG_DIR) clean

jpeg-dirclean:
	rm -rf $(JPEG_DIR)

#############################################################
#
# Toplevel Makefile options