--- fsl-mm-codeclib-2.0.1/Makefile	2011-07-14 15:11:08.000000000 -0400
+++ fsl-mm-codeclib-2.0.1/Makefile	2011-07-14 15:10:27.000000000 -0400
@@ -54,69 +54,71 @@
 	mkdir -p $(DESTDIR)/$(PREFIX)/lib
 	mkdir -p $(DESTDIR)/$(PREFIX)/bin
 	mkdir -p $(DESTDIR)/$(PREFIX)/include
-	find $(LIBDIR) -name "*arm9*.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(LIBDIR) -name "*arm11*.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(LIBDIR) -name "*arm12*.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "*test_*" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "*arm9*.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(LIBDIR) -name "*arm11*.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(LIBDIR) -name "*arm12*.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "*test_*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	@#fixup broken symlinks
+	for link in $$(find $(DESTDIR)/$(PREFIX)/lib -type l);do LIB=$$(readlink $$link); if [ ! -f $(DESTDIR)/$(PREFIX)/lib/$$LIB ]; then cp $(LIBDIR)/$$LIB $(DESTDIR)/$(PREFIX)/lib/;fi;done
 
 mx25-install:
 mx233-install:
 mx27-install:
 	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm12*.*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm11*.*" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_deinterlace_arm11_elinux.so" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_deinterlace_arm11_elinux.so*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/bin/ -name "test*arm11*.*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/bin/ -name "test*arm12*.*" | xargs rm -f
 
 mx31-install:
 	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm12*.*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm9*.*" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_deinterlace_arm11_elinux.so" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_deinterlace_arm11_elinux.so*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/bin/ -name "test*arm9*.*" | xargs rm -f
 	find $(DESTDIR)/bin/ -name "test*arm12*.*" | xargs rm -f
-	find $(LIBDIR) -name "lib_wb_amr_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_wb_amr_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
-	find $(LIBDIR) -name "lib_nb_amr_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_nb_amr_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
-	find $(LIBDIR) -name "lib_g.729ab_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_g.729ab_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
-	find $(LIBDIR) -name "lib_g.723.1_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_g.723.1_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_wb_amr_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_wb_amr_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_nb_amr_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_nb_amr_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_g.729ab_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_g.729ab_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_g.723.1_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_g.723.1_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
 
 mx35-install: mx31-install
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "libmpeg4_encoder_arm11_ELINUX.so" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "libmpeg4_encoder_arm11_ELINUX.so*" | xargs rm -f
 
 mx37-install: mx35-install
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_H264_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mpeg2_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4ASP_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_WMV9MP_dec_MP_arm11_elinux.so" | xargs rm -f
-	find $(LIBDIR) -name "lib_deinterlace_arm11_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_H264_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mpeg2_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4ASP_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_WMV9MP_dec_MP_arm11_elinux.so*" | xargs rm -f
+	find $(LIBDIR) -name "lib_deinterlace_arm11_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
 
 mx51-install: mx5x-install
 
 mx53-install: mx5x-install
 
 mx5x-install:
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm9*.so" | xargs rm -f
-	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_H264_dec_arm11_elinux.so" | xargs rm -f
-	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mpeg2_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4_dec_arm11_elinux.so" | xargs rm -f
-	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4ASP_dec_arm11_elinux.so" | xargs rm -f
-	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_WMV9MP_dec_MP_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_wma10_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mp3_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_aac_dec_arm11_elinux.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "libmpeg4_encoder_arm11_ELINUX.so" | xargs rm -f
-	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mp3_enc_arm11_elinux.so" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "*arm9*.so*" | xargs rm -f
+	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_H264_dec_arm11_elinux.so*" | xargs rm -f
+	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mpeg2_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4_dec_arm11_elinux.so*" | xargs rm -f
+	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_MPEG4ASP_dec_arm11_elinux.so*" | xargs rm -f
+	# find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_WMV9MP_dec_MP_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_wma10_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mp3_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_aac_dec_arm11_elinux.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "libmpeg4_encoder_arm11_ELINUX.so*" | xargs rm -f
+	find $(DESTDIR)/$(PREFIX)/lib/ -name "lib_mp3_enc_arm11_elinux.so*" | xargs rm -f
 	find $(DESTDIR)/$(PREFIX)/bin/ -name "test*arm9*" | xargs rm -f
-	find $(LIBDIR) -name "lib_nb_amr_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_nb_amr_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
-	find $(LIBDIR) -name "lib_g.729ab_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_g.729ab_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
-	find $(LIBDIR) -name "lib_g.723.1_*_arm9_elinux.so" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/lib/
-	find $(BINDIR) -name "test_g.723.1_*_arm9_elinux" | xargs -I corelib install corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_nb_amr_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_nb_amr_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_g.729ab_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_g.729ab_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
+	find $(LIBDIR) -name "lib_g.723.1_*_arm9_elinux.so*" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/lib/
+	find $(BINDIR) -name "test_g.723.1_*_arm9_elinux" | xargs -I corelib cp -fP corelib $(DESTDIR)/$(PREFIX)/bin/
 
 install: install-common $(INSTALL_TARGET)
 	mkdir -p $(DESTDIR)/$(PREFIX)/include/mm_ghdr/
