From 76b1469b1636f47b01e35bb4674fec31470fac75 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 19 May 2019 18:27:26 -0400 Subject: build: Replace mkdir/mv commands with $(inst) func This allows installation commands to be shorter and should fix: # C++ headers: mkdir -p \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/gcc/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/gcc/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//')/fixed \ dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') \ dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//')/backward mv dest-amd64-linux-glibc/usr/lib/amd64-linux-glibc/gcc/$(oh-architecture amd64-linux-glibc)/$(printf '%s\n' '8.3.0+sip1' | sed 's/+sip.*//')/include/* \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/gcc/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') mv dest-amd64-linux-glibc/usr/lib/amd64-linux-glibc/gcc/$(oh-architecture amd64-linux-glibc)/$(printf '%s\n' '8.3.0+sip1' | sed 's/+sip.*//')/include-fixed/* \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/gcc/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//')/fixed # def_gcc_gxx_tool_include_dir and def_gcc_gxx_backward_include_dir are # subdirectories of def_gcc_gxx_include_dir, so move them first. mv dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' '8.3.0+sip1' | sed 's/+sip.*//')/$(oh-architecture amd64-linux-glibc)/* \ dest-amd64-linux-glibc/usr/include/amd64-linux-glibc/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') mv dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' '8.3.0+sip1' | sed 's/+sip.*//')/backward/* \ dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//')/backward mv dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' '8.3.0+sip1' | sed 's/+sip.*//')/* \ dest-amd64-linux-glibc/usr/include/c++/$(printf '%s\n' 'gcc-8' | sed 's/^gcc-//') mv: can't rename 'dest-amd64-linux-glibc/usr/include/c++/8.3.0/backward': Directory not empty ../build:150: recipe for target 'install-native' failed make[1]: *** [install-native] Error 1 make[1]: Leaving directory '/prokit/sessions/445794320/wd/tmp' ../build:308: recipe for target 'install' failed make: *** [install] Error 2 --- (limited to 'build') diff --git a/build b/build index b229d27..5b66800 100755 --- a/build +++ b/build @@ -146,6 +146,16 @@ build-cross: build-gcc-config -j $${JOBS:-$(jobs)} \ $(dir_macros) +inst = set -e; \ + inst() { \ + i=0; for d in "$${@}"; do : $$((i += 1)); done; \ + mkdir -p "$(destdir)$$(printf '%s\n' $${d} | sed 's|/.*$$||')";\ + for s in "$${@}"; do [ $$((i -= 1)) -eq 0 ] && break; \ + rm -Rf "$(destdir)$${d}"; \ + mv "$(destdir)$${s}" "$(destdir)$${d}"; \ + done; \ + }; inst + install-native: # The -T option is necessary because otherwise: # * oh-autoinstall checks for an "install" target by running make with @@ -168,44 +178,32 @@ install-native: $(destdir)/usr/bin/$(target)-c++-$(base_version) # Move files into ProteanOS-style directories. # gcc programs: - mkdir -p $(destdir)$(gccexedir) - mv \ - $(destdir)$(libsubdir)/cc1* \ - $(destdir)$(libsubdir)/collect2 \ - $(destdir)$(libsubdir)/lto* \ - $(destdir)$(gccexedir) + $(inst) $(libsubdir)/cc1* \ + $(libsubdir)/collect2 \ + $(libsubdir)/lto* \ + $(gccexedir) # Start files and gcc libraries: - mkdir -p $(destdir)$(tgtlibdir) - mv \ - $(destdir)$(libsubdir)/*.o \ - $(destdir)$(libsubdir)/*.a \ - $(destdir)$(libsubdir)/*.so* \ - $(destdir)$(tgtlibdir) + $(inst) $(libsubdir)/*.o \ + $(libsubdir)/*.a \ + $(libsubdir)/*.so* \ + $(tgtlibdir) # C++ headers: - mkdir -p \ - $(destdir)$(gcc_gcc_include_dir) \ - $(destdir)$(gcc_fixed_include_dir) \ - $(destdir)$(gcc_gxx_include_dir) \ - $(destdir)$(gcc_gxx_tool_include_dir) \ - $(destdir)$(gcc_gxx_backward_include_dir) - mv $(destdir)$(def_gcc_gcc_include_dir)/* \ - $(destdir)$(gcc_gcc_include_dir) - mv $(destdir)$(def_gcc_fixed_include_dir)/* \ - $(destdir)$(gcc_fixed_include_dir) + $(inst) $(def_gcc_gcc_include_dir) \ + $(gcc_gcc_include_dir) + $(inst) $(def_gcc_fixed_include_dir) \ + $(gcc_fixed_include_dir) # def_gcc_gxx_tool_include_dir and def_gcc_gxx_backward_include_dir are # subdirectories of def_gcc_gxx_include_dir, so move them first. - mv $(destdir)$(def_gcc_gxx_tool_include_dir)/* \ - $(destdir)$(gcc_gxx_tool_include_dir) - mv $(destdir)$(def_gcc_gxx_backward_include_dir)/* \ - $(destdir)$(gcc_gxx_backward_include_dir) - mv $(destdir)$(def_gcc_gxx_include_dir)/* \ - $(destdir)$(gcc_gxx_include_dir) + $(inst) $(def_gcc_gxx_tool_include_dir) \ + $(gcc_gxx_tool_include_dir) + $(inst) $(def_gcc_gxx_backward_include_dir) \ + $(gcc_gxx_backward_include_dir) + $(inst) $(def_gcc_gxx_include_dir) \ + $(gcc_gxx_include_dir) # Target-arch libraries: - mkdir -p $(destdir)$(libdir) - mv $(destdir)$(libdir)/$(libsuffix)/* $(destdir)$(libdir) + $(inst) $(libdir)/$(libsuffix) $(libdir) # Put libgcc_s.so.* under /lib. - mkdir -p $(destdir)/lib/$(OPK_HOST_ARCH) - mv $(destdir)$(libdir)/libgcc_s.so.* $(destdir)/lib/$(OPK_HOST_ARCH) + $(inst) $(libdir)/libgcc_s.so.* /lib/$(OPK_HOST_ARCH) # Put *.so links in a versioned directory. We want links to # libfoo.so.x, not libfoo.x.y.z as libtool generates. set -e; \ @@ -216,7 +214,7 @@ install-native: ln -sf ../../$${lib} $(destdir)$(tgtlibdir)/$${link}; \ done # Put *.o and *.spec files in a versioned directory. - mv $(destdir)$(libdir)/*.o $(destdir)$(libdir)/*.spec \ + $(inst) $(destdir)$(libdir)/*.o $(destdir)$(libdir)/*.spec \ $(destdir)$(tgtlibdir) # Remove libitm files. rm -f $(destdir)$(libdir)/libitm.* @@ -270,12 +268,10 @@ install-cross: ln -s $(target)-g++-$(base_version) \ $(destdir)/usr/bin/$(target)-c++-$(base_version) # Move files into ProteanOS-style directories. - mkdir -p $(destdir)$(gccexedir) - mv \ - $(destdir)$(libsubdir)/cc1* \ - $(destdir)$(libsubdir)/collect2 \ - $(destdir)$(libsubdir)/lto* \ - $(destdir)$(gccexedir) + $(inst) $(libsubdir)/cc1* \ + $(libsubdir)/collect2 \ + $(libsubdir)/lto* \ + $(gccexedir) rm -Rf \ $(destdir)$(libsubdir)/*.o \ $(destdir)$(libsubdir)/include* \ -- cgit v0.9.1