diff --git a/.gitignore b/.gitignore index e572afb4dd9..d3db3d09ff0 100644 --- a/.gitignore +++ b/.gitignore @@ -80,14 +80,11 @@ src/ocaml-flags-configure.sexp src/**/.merlin src/client/linking.sexp src/client/no-git-version +src/core/cc64 +src/core/c-flags.sexp src/core/developer src/manifest/dune src/manifest/install.inc -src/stubs/libacl/dune -src/stubs/libacl/c-libraries.sexp -src/stubs/win32/cc64 -src/stubs/win32/dune -src/stubs/c-flags.sexp # doc doc/dev-manual/*aux doc/dev-manual/*.html diff --git a/Makefile b/Makefile index 4cad15d7c7b..1f07139c43f 100644 --- a/Makefile +++ b/Makefile @@ -96,8 +96,8 @@ clean: distclean: clean clean-ext rm -rf autom4te.cache bootstrap rm -f Makefile.config config.log config.status aclocal.m4 - rm -f src/*.META src/*/.merlin src/manifest/dune src/manifest/install.inc src/stubs/libacl/dune src/stubs/win32/dune src/stubs/win32/cc64 src/ocaml-flags-configure.sexp src/stubs/libacl/c-libraries.sexp - rm -f src/client/linking.sexp src/stubs/c-flags.sexp src/core/developer src/core/version + rm -f src/*.META src/*/.merlin src/manifest/dune src/manifest/install.inc src/stubs/win32/dune src/core/cc64 src/ocaml-flags-configure.sexp + rm -f src/client/linking.sexp src/core/c-flags.sexp src/core/developer src/core/version OPAMINSTALLER_FLAGS = --prefix "$(call CYGPATH,$(DESTDIR)$(prefix))" OPAMINSTALLER_FLAGS += --mandir "$(call CYGPATH,$(DESTDIR)$(mandir))" diff --git a/configure b/configure index 0f17f6b7206..be601110dd6 100755 --- a/configure +++ b/configure @@ -615,38 +615,6 @@ PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_default_prefix=`echo "os_type: ${OCAML_OS_TYPE}" | sed -e "s;^os_type: Win32;C:/OPAM;" -e "s;^os_type:.*;/usr/local;"` -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_STDIO_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_header_c_list= ac_subst_vars='LTLIBOBJS LIBOBJS VENDORED @@ -687,7 +655,6 @@ PATH_PREPEND CC64 CONF_CFLAGS CONF_OCAMLFLAGS -CONF_LIBACL_LINK MCCS_ENABLED DEVELOPER OBJEXT @@ -767,7 +734,6 @@ enable_checks enable_developer_mode with_mccs with_0install_solver -with_libacl with_private_runtime enable_static enable_cold_check @@ -1428,7 +1394,6 @@ Optional Packages: --without-0install-solver Legacy option (does nothing) - --with-libacl Compile opam with libacl support --with-private-runtime For a mingw-w64 build, manifest the runtime DLLs locally in Opam.Runtime.arch --without-dune Compile using vendored Dune instead of any in PATH @@ -1568,86 +1533,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. @@ -2289,15 +2174,6 @@ main (int argc, char **argv) } " -as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" -as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" -as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" -as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" -as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" -as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" -as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" -as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" -as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? @@ -4021,16 +3897,6 @@ fi -# Check whether --with-libacl was given. -if test ${with_libacl+y} -then : - withval=$with_libacl; -else $as_nop - with_libacl=auto -fi - - - # Check whether --with-private_runtime was given. if test ${with_private_runtime+y} then : @@ -4973,143 +4839,6 @@ else $as_nop fi - -ac_header= ac_cache= -for ac_item in $ac_header_c_list -do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - - - - - - - - -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes -then : - -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h - -fi -if test "x${with_libacl}" != "xno" -then : - - have_libacl=yes - ac_fn_c_check_header_compile "$LINENO" "acl/libacl.h" "ac_cv_header_acl_libacl_h" "$ac_includes_default" -if test "x$ac_cv_header_acl_libacl_h" = xyes -then : - -else $as_nop - have_libacl=no -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing acl_get_perm" >&5 -printf %s "checking for library containing acl_get_perm... " >&6; } -if test ${ac_cv_search_acl_get_perm+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char acl_get_perm (); -int -main (void) -{ -return acl_get_perm (); - ; - return 0; -} -_ACEOF -for ac_lib in '' acl -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_acl_get_perm=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_acl_get_perm+y} -then : - break -fi -done -if test ${ac_cv_search_acl_get_perm+y} -then : - -else $as_nop - ac_cv_search_acl_get_perm=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_acl_get_perm" >&5 -printf "%s\n" "$ac_cv_search_acl_get_perm" >&6; } -ac_res=$ac_cv_search_acl_get_perm -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -else $as_nop - have_libacl=no -fi - - if test "x${SYSTEM}" = "xcygwin" -then : - - if test "x${have_libacl}" = "xno" -then : - as_fn_error $? "opam on Cygwin requires libacl" "$LINENO" 5 -else $as_nop - with_libacl=yes -fi - -fi - if test "x${with_libacl}${have_libacl}" = "xyesno" -then : - as_fn_error $? "libacl not found" "$LINENO" 5 -fi - -fi -if test "x${with_libacl}" = "xyes" -then : - - if test "x${ac_cv_search_acl_get_perm}" = "xnone required" -then : - - - -else $as_nop - - CONF_LIBACL_LINK=${ac_cv_search_acl_get_perm} - - -fi - -fi - CONF_OCAMLFLAGS='' if test "x${CI}" != "x" -o "x${enable_developer_mode}" = "xyes" @@ -5272,8 +5001,8 @@ fi if test "x${CC64}" != "xno" then : - echo "${CC64} -o " > src/stubs/win32/cc64 - echo " -Wdeclaration-after-statement -municode " >> src/stubs/win32/cc64 + echo "${CC64} -o " > src/core/cc64 + echo " -Wdeclaration-after-statement -municode " >> src/core/cc64 fi @@ -5319,14 +5048,14 @@ else $as_nop printf "%s\n" "from $MSVS_NAME" >&6; } CL_FULL="`PATH="${MSVS_PATH}:${PATH}" which cl | cygpath -f - -w`" MSVS_PATH="`echo "${MSVS_PATH}" | cygpath -f - -wp`" - echo "cl /nologo /Fe" > src/stubs/win32/cc64 - echo " " >> src/stubs/win32/cc64 - echo "PATH" >> src/stubs/win32/cc64 - echo "${MSVS_PATH}" >> src/stubs/win32/cc64 - echo "LIB" >> src/stubs/win32/cc64 - echo "${MSVS_LIB}" >> src/stubs/win32/cc64 - echo "INCLUDE" >> src/stubs/win32/cc64 - echo "${MSVS_INC}" >> src/stubs/win32/cc64 + echo "cl /nologo /Fe" > src/core/cc64 + echo " " >> src/core/cc64 + echo "PATH" >> src/core/cc64 + echo "${MSVS_PATH}" >> src/core/cc64 + echo "LIB" >> src/core/cc64 + echo "${MSVS_LIB}" >> src/core/cc64 + echo "INCLUDE" >> src/core/cc64 + echo "${MSVS_INC}" >> src/core/cc64 fi @@ -6091,7 +5820,7 @@ fi # NOTE: On Windows, the Windows specific dlls should stay dynamic for security reasons # NOTE: -l:libstdc++.a is necessary (vs. -lstdc++) as flexlink will use libstdc++.dll.a # which still depends on the DLL at runtime instead of libstdc++.a (that looks like a bug in flexlink) - platform_dependent_stuff="-cclib -lopam_stubs_win32_stubs -cclib -l:libstdc++.a -cclib -l:libpthread.a -cclib -Wl,-static -cclib -ladvapi32 -cclib -lgdi32 -cclib -luser32 -cclib -lshell32 -cclib -lole32 -cclib -luuid -cclib -luserenv" + platform_dependent_stuff="-cclib -l:libstdc++.a -cclib -l:libpthread.a -cclib -Wl,-static -cclib -ladvapi32 -cclib -lgdi32 -cclib -luser32 -cclib -lshell32 -cclib -lole32 -cclib -luuid -cclib -luserenv" if test "x${SYSTEM}" = "xmingw" then : platform_dependent_stuff="${platform_dependent_stuff} -cclib -lwindowsapp" @@ -6151,7 +5880,7 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version fi - echo "(-noautolink -cclib -l${unix_lib_name} -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs ${platform_dependent_stuff})" > src/client/linking.sexp + echo "(-noautolink -cclib -l${unix_lib_name} -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs -cclib -lopam_core_stubs ${platform_dependent_stuff})" > src/client/linking.sexp { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5 printf "%s\n" "static" >&6; } @@ -7347,7 +7076,7 @@ if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi -ac_config_files="$ac_config_files Makefile.config src/ocaml-flags-configure.sexp src/stubs/c-flags.sexp src/stubs/libacl/c-libraries.sexp" +ac_config_files="$ac_config_files Makefile.config src/ocaml-flags-configure.sexp src/core/c-flags.sexp" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8052,8 +7781,7 @@ do case $ac_config_target in "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "src/ocaml-flags-configure.sexp") CONFIG_FILES="$CONFIG_FILES src/ocaml-flags-configure.sexp" ;; - "src/stubs/c-flags.sexp") CONFIG_FILES="$CONFIG_FILES src/stubs/c-flags.sexp" ;; - "src/stubs/libacl/c-libraries.sexp") CONFIG_FILES="$CONFIG_FILES src/stubs/libacl/c-libraries.sexp" ;; + "src/core/c-flags.sexp") CONFIG_FILES="$CONFIG_FILES src/core/c-flags.sexp" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -8525,25 +8253,6 @@ fi fi -rm -f src/stubs/win32/dune -if test ${WIN32} -eq 1 -then : - - cd src/stubs/win32 - ${LN_S} -f dune-win32 dune - cd ../../.. - -fi -rm -f src/stubs/libacl/dune -if test "x${with_libacl}" = "xyes" -then : - - cd src/stubs/libacl - ${LN_S} -f dune-libacl dune - cd ../../.. - -fi - echo bindir="`eval echo ${bindir}`" diff --git a/configure.ac b/configure.ac index 756bbfe74d2..670ad0254fb 100644 --- a/configure.ac +++ b/configure.ac @@ -69,9 +69,6 @@ AS_IF([test "x$with_0install_solver" = xno], ) -AC_ARG_WITH([libacl], - AS_HELP_STRING([--with-libacl],[Compile opam with libacl support]),,[with_libacl=auto]) - AC_ARG_WITH([private_runtime], AS_HELP_STRING([--with-private-runtime],[For a mingw-w64 build, manifest the runtime DLLs locally in Opam.Runtime.arch]),,[with_private_runtime=no] ) @@ -165,23 +162,6 @@ AS_IF([test "x${enable_developer_mode}" = "xyes"],[ AS_IF([test "x${with_mccs}" = "xno"], [AC_SUBST(MCCS_ENABLED,false)], [AC_SUBST(MCCS_ENABLED,true)]) -AS_IF([test "x${with_libacl}" != "xno"],[ - have_libacl=yes - AC_CHECK_HEADER([acl/libacl.h],,[have_libacl=no]) - AC_SEARCH_LIBS([acl_get_perm],[acl],,[have_libacl=no]) - AS_IF([test "x${SYSTEM}" = "xcygwin"],[ - AS_IF([test "x${have_libacl}" = "xno"],[AC_MSG_ERROR([opam on Cygwin requires libacl])],[with_libacl=yes]) - ]) - AS_IF([test "x${with_libacl}${have_libacl}" = "xyesno"],[AC_MSG_ERROR([libacl not found])]) -]) -AS_IF([test "x${with_libacl}" = "xyes"],[ - AS_IF([test "x${ac_cv_search_acl_get_perm}" = "xnone required"],[ - AC_SUBST(CONF_LIBACL_LINK,[]) - ],[ - AC_SUBST(CONF_LIBACL_LINK,[${ac_cv_search_acl_get_perm}]) - ]) -]) - CONF_OCAMLFLAGS='' AS_IF([test "x${CI}" != "x" -o "x${enable_developer_mode}" = "xyes"],[ @@ -218,8 +198,8 @@ AS_IF([ test ${WIN32} -eq 1 ],[ ac_tool_prefix='x86_64-w64-mingw32-'])]) AC_CHECK_TOOL(CC64,[${T_CC64}],[no]) AS_IF([ test "x${CC64}" != "xno" ],[ - echo "${CC64} -o " > src/stubs/win32/cc64 - echo " -Wdeclaration-after-statement -municode " >> src/stubs/win32/cc64 + echo "${CC64} -o " > src/core/cc64 + echo " -Wdeclaration-after-statement -municode " >> src/core/cc64 ]) ],[ AC_MSG_CHECKING([whether Microsoft Linker needs a PATH shim]) @@ -243,14 +223,14 @@ AS_IF([ test ${WIN32} -eq 1 ],[ AC_MSG_RESULT([from $MSVS_NAME]) CL_FULL="`PATH="${MSVS_PATH}:${PATH}" which cl | cygpath -f - -w`" MSVS_PATH="`echo "${MSVS_PATH}" | cygpath -f - -wp`" - echo "cl /nologo /Fe" > src/stubs/win32/cc64 - echo " " >> src/stubs/win32/cc64 - echo "PATH" >> src/stubs/win32/cc64 - echo "${MSVS_PATH}" >> src/stubs/win32/cc64 - echo "LIB" >> src/stubs/win32/cc64 - echo "${MSVS_LIB}" >> src/stubs/win32/cc64 - echo "INCLUDE" >> src/stubs/win32/cc64 - echo "${MSVS_INC}" >> src/stubs/win32/cc64 + echo "cl /nologo /Fe" > src/core/cc64 + echo " " >> src/core/cc64 + echo "PATH" >> src/core/cc64 + echo "${MSVS_PATH}" >> src/core/cc64 + echo "LIB" >> src/core/cc64 + echo "${MSVS_LIB}" >> src/core/cc64 + echo "INCLUDE" >> src/core/cc64 + echo "${MSVS_INC}" >> src/core/cc64 ]) ]) AS_IF([ test "x${CC64}" = "xno" ],[ @@ -350,7 +330,7 @@ AS_CASE([$TARGET], # NOTE: On Windows, the Windows specific dlls should stay dynamic for security reasons # NOTE: -l:libstdc++.a is necessary (vs. -lstdc++) as flexlink will use libstdc++.dll.a # which still depends on the DLL at runtime instead of libstdc++.a (that looks like a bug in flexlink) - platform_dependent_stuff="-cclib -lopam_stubs_win32_stubs -cclib -l:libstdc++.a -cclib -l:libpthread.a -cclib -Wl,-static -cclib -ladvapi32 -cclib -lgdi32 -cclib -luser32 -cclib -lshell32 -cclib -lole32 -cclib -luuid -cclib -luserenv" + platform_dependent_stuff="-cclib -l:libstdc++.a -cclib -l:libpthread.a -cclib -Wl,-static -cclib -ladvapi32 -cclib -lgdi32 -cclib -luser32 -cclib -lshell32 -cclib -lole32 -cclib -luuid -cclib -luserenv" AS_IF([test "x${SYSTEM}" = "xmingw"], [platform_dependent_stuff="${platform_dependent_stuff} -cclib -lwindowsapp"]) ]) AS_CASE([${support_static},${enable_static}], @@ -362,7 +342,7 @@ AS_IF([test "${enable_static}" = yes],[ ],[ unix_lib_name=unixnat ]) - echo "(-noautolink -cclib -l${unix_lib_name} -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs ${platform_dependent_stuff})" > src/client/linking.sexp + echo "(-noautolink -cclib -l${unix_lib_name} -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs -cclib -lopam_core_stubs ${platform_dependent_stuff})" > src/client/linking.sexp AC_MSG_RESULT([static]) ],[ AC_MSG_RESULT([shared]) @@ -453,8 +433,7 @@ fi AC_CONFIG_FILES( Makefile.config src/ocaml-flags-configure.sexp - src/stubs/c-flags.sexp - src/stubs/libacl/c-libraries.sexp + src/core/c-flags.sexp ) AC_OUTPUT @@ -470,19 +449,6 @@ AS_IF([test "x${with_private_runtime}" != "xno"],[ ]) ]) -rm -f src/stubs/win32/dune -AS_IF([ test ${WIN32} -eq 1],[ - cd src/stubs/win32 - ${LN_S} -f dune-win32 dune - cd ../../.. -]) -rm -f src/stubs/libacl/dune -AS_IF([ test "x${with_libacl}" = "xyes" ],[ - cd src/stubs/libacl - ${LN_S} -f dune-libacl dune - cd ../../.. -]) - echo bindir="`eval echo ${bindir}`" diff --git a/doc/index.html b/doc/index.html index f27e6e37661..6c052c5959f 100644 --- a/doc/index.html +++ b/doc/index.html @@ -86,20 +86,12 @@

opam %{OPAMVERSION}% API and libraries documentation

C stubs for Windows. A “dummy” alternate is provided for Unix, which doesn’t require any C code opamStubsTypes.ml Types in the stubs definitions (shared between both implementations) - - - src/stubs - opam-stubs library - - - - C stubs. This library is built on Windows-only and automatically pulled into opam-core if needed - - opamInject.c Code for process injection shared between opamWindows.c and opam-putenv.c opamWindows.c - C stubs themselves + C stubs for Windows +opamCommonStubs.c + Common C stubs for Unix and Windows src/format diff --git a/dune-project b/dune-project index dc537179296..15b75c2e8d0 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 2.0) +(lang dune 2.6) (name opam) (implicit_transitive_deps true) diff --git a/master_changes.md b/master_changes.md index 4f6ca69d33e..80ddccb6505 100644 --- a/master_changes.md +++ b/master_changes.md @@ -113,6 +113,7 @@ users) * Require opam-0install-cudf >= 0.5.0 [#6130 @kit-ty-kate] * Bump the vendored mccs to 1.1+18 [#6170 @kit-ty-kate] * Fix Windows builds with OCaml >= 5.0 [#6189 @kit-ty-kate - fix #6148] + * Upgrade the minimum required version for dune from 2.0.0 to 2.6.0 [#5381 @dra27] ## Infrastructure @@ -158,6 +159,8 @@ users) * Reduce allocations in OpamVersionCompare [#6144 @talex5] * Speedup OpamVersionCompare by 25% by removing the unused handling of epoch [#5518 @kit-ty-kate] * Fix error in `OpamSystem.transform_patch` - patches were only applied when debugging [#6182 @dra27 regression since #3449] + * Remove `--with-acl` option from the configure script and its related C stubs (reverts a Cygwin fix in #4265) [#5381 @kit-ty-kate - fix #5373] + * Move Windows stubs to opam-core [#5381 @dra27] ## Internal: Windows @@ -272,3 +275,5 @@ users) * `OpamHash`: export `compare_kind` [#5561 @rjbou] * `OpamFilename`: add `might_escape` to check if a path is escapable, ie contains `..` [#5561 @rjbou] * Add `OpamStd.Sys.getconf` [#5950 @kit-ty-kate] + * `OpamStd.Sys.resolve_command`: Fix opam unable to find executables on systems where users belong to more than 32 groups when opam is built using musl libc [#5381 @kit-ty-kate - fix #5373] + * `OpamACL`: remove module [#5381 @kit-ty-kate] diff --git a/opam-client.opam b/opam-client.opam index 1972746ebc7..b2c9407c00e 100644 --- a/opam-client.opam +++ b/opam-client.opam @@ -35,7 +35,7 @@ depends: [ "opam-repository" {= version} "re" {>= "1.10.0"} "cmdliner" {>= "1.1.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} ] conflicts: [ "extlib" {< "1.7.8"} diff --git a/opam-core.opam b/opam-core.opam index 4778b85c518..d901e7ba809 100644 --- a/opam-core.opam +++ b/opam-core.opam @@ -26,7 +26,7 @@ depends: [ "base-unix" "ocamlgraph" "re" {>= "1.9.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} "sha" {>= "1.13"} "jsonm" "swhid_core" diff --git a/opam-devel.opam b/opam-devel.opam index ed2015b8cb8..afcbcaf9c42 100644 --- a/opam-devel.opam +++ b/opam-devel.opam @@ -31,7 +31,7 @@ depends: [ "ocaml" {>= "4.08.0"} "opam-client" {= version} "cmdliner" {>= "1.1.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} "conf-openssl" {with-test} "conf-diffutils" {with-test} ] diff --git a/opam-format.opam b/opam-format.opam index 4a3915e5d4d..cd4cb6a03c1 100644 --- a/opam-format.opam +++ b/opam-format.opam @@ -32,5 +32,5 @@ depends: [ "opam-core" {= version} "opam-file-format" {>= "2.1.4"} "re" {>= "1.9.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} ] diff --git a/opam-installer.opam b/opam-installer.opam index 2de65fca63e..7c93f15c623 100644 --- a/opam-installer.opam +++ b/opam-installer.opam @@ -33,5 +33,5 @@ depends: [ "ocaml" {>= "4.08.0"} "opam-format" {= version} "cmdliner" {>= "0.9.8"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} ] diff --git a/opam-repository.opam b/opam-repository.opam index a697de4f2f0..470cb759fdd 100644 --- a/opam-repository.opam +++ b/opam-repository.opam @@ -30,5 +30,5 @@ build: [ depends: [ "ocaml" {>= "4.08.0"} "opam-format" {= version} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} ] diff --git a/opam-solver.opam b/opam-solver.opam index 40ead91ed5c..09e0f3ae589 100644 --- a/opam-solver.opam +++ b/opam-solver.opam @@ -34,7 +34,7 @@ depends: [ "dose3" {>= "6.1"} "cudf" {>= "0.7"} "re" {>= "1.9.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} "opam-0install-cudf" {>= "0.5.0"} ] depopts: [ diff --git a/opam-state.opam b/opam-state.opam index 7db07f42f89..8306aac95bc 100644 --- a/opam-state.opam +++ b/opam-state.opam @@ -32,5 +32,5 @@ depends: [ "opam-repository" {= version} "re" {>= "1.9.0"} "spdx_licenses" {>= "1.0.0"} - "dune" {>= "2.0.0"} + "dune" {>= "2.6.0"} ] diff --git a/src/stubs/win32/build-putenv.ml b/shell/build-putenv.ml similarity index 100% rename from src/stubs/win32/build-putenv.ml rename to shell/build-putenv.ml diff --git a/src/stubs/c-flags.sexp.in b/src/core/c-flags.sexp.in similarity index 100% rename from src/stubs/c-flags.sexp.in rename to src/core/c-flags.sexp.in diff --git a/src/core/dune b/src/core/dune index b6ee4edac57..723aa44aaab 100644 --- a/src/core/dune +++ b/src/core/dune @@ -3,29 +3,39 @@ (public_name opam-core) (synopsis "OCaml Package Manager core internal stdlib") ; TODO: Remove (re_export ...) when CI uses the OCaml version that includes https://github.com/ocaml/ocaml/pull/11989 - (libraries re (re_export ocamlgraph) unix sha jsonm swhid_core uutf - (select opamACL.ml from - (opam-core.libacl -> opamACL.libacl.ml) - ( -> opamACL.dummy.ml)) - (select opamStubs.ml from - (opam-core.stubs -> opamStubs.win32.ml) - ( -> opamStubs.dummy.ml))) + (libraries re (re_export ocamlgraph) unix sha jsonm swhid_core uutf) (flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-flags-configure.sexp) (:include ../ocaml-context-flags.sexp))) + (foreign_stubs + (language c) + (names opam_stubs) + (flags :standard + -DUNICODE -D_UNICODE -DCAML_NAME_SPACE + (:include c-flags.sexp))) + (c_library_flags (:standard + (:include c-libraries.sexp))) (wrapped false)) (rule - (copy opamStubsTypes.ml opamStubsTypes.mli)) + (deps opamWindows.c opamInject.c) + (action (copy# opamCommonStubs.c opam_stubs.c))) (rule - (enabled_if (< %{ocaml_version} "5.0")) - (action (copy# opamStubs.ocaml4.ml opamStubs.win32.ml))) + (copy# opamStubsTypes.ml opamStubsTypes.mli)) (rule - (enabled_if (>= %{ocaml_version} "5.0")) - (action (copy# opamStubs.ocaml5.ml opamStubs.win32.ml))) + (enabled_if (<> %{os_type} "Win32")) + (action (copy# opamStubs.unix.ml opamStubs.ml))) + +(rule + (enabled_if (and (= %{os_type} "Win32") (< %{ocaml_version} "5.0"))) + (action (copy# opamStubs.ocaml4.ml opamStubs.ml))) + +(rule + (enabled_if (and (= %{os_type} "Win32") (>= %{ocaml_version} "5.0"))) + (action (copy# opamStubs.ocaml5.ml opamStubs.ml))) (rule (write-file opamCoreConfigDeveloper.ml @@ -44,3 +54,23 @@ (targets developer) (mode fallback) (action (with-stdout-to %{targets} (echo "")))) + +(rule + (enabled_if (= %{os_type} "Win32")) + (targets opam-putenv.exe) + (deps opamInject.c) + (action (run ocaml %{dep:../../shell/build-putenv.ml} %{targets} %{dep:opam-putenv.c} %{dep:cc64}))) + +(install + (enabled_if (= %{os_type} "Win32")) + (section bin) + (package opam) + (files opam-putenv.exe)) + +(rule + (with-stdout-to c-libraries.sexp (run ocaml %{dep:../../shell/context_flags.ml} clibs))) + +(rule + (targets c-flags.sexp) + (mode fallback) + (action (with-stdout-to %{targets} (echo "()")))) diff --git a/src/stubs/win32/opam-putenv.c b/src/core/opam-putenv.c similarity index 100% rename from src/stubs/win32/opam-putenv.c rename to src/core/opam-putenv.c diff --git a/src/core/opamACL.dummy.ml b/src/core/opamACL.dummy.ml deleted file mode 100644 index 7d780f43da0..00000000000 --- a/src/core/opamACL.dummy.ml +++ /dev/null @@ -1,11 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright 2020 David Allsopp Ltd. *) -(* *) -(* All rights reserved. This file is distributed under the terms of the *) -(* GNU Lesser General Public License version 2.1, with the special *) -(* exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -let get_acl_executable_info _ _ = None diff --git a/src/core/opamACL.libacl.ml b/src/core/opamACL.libacl.ml deleted file mode 100644 index 4cc599b5efc..00000000000 --- a/src/core/opamACL.libacl.ml +++ /dev/null @@ -1,11 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright 2020 David Allsopp Ltd. *) -(* *) -(* All rights reserved. This file is distributed under the terms of the *) -(* GNU Lesser General Public License version 2.1, with the special *) -(* exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -include OpamlibACL diff --git a/src/core/opamACL.mli b/src/core/opamACL.mli deleted file mode 100644 index 4fb451be994..00000000000 --- a/src/core/opamACL.mli +++ /dev/null @@ -1,22 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright 2020 David Allsopp Ltd. *) -(* *) -(* All rights reserved. This file is distributed under the terms of the *) -(* GNU Lesser General Public License version 2.1, with the special *) -(* exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -(** C auxiliary function used for POSIX 1003.1e DRAFT 17 permission checking. *) - -val get_acl_executable_info : string -> int -> int list option - (** If compiled without libacl support, this function always returns None - When opam is built with libacl support, - [get_acl_executable_info file owner] takes a filename and the uid of the - owner of that file (this is passed since the caller will have already - called {!Unix.stat}). The function returns [Some []] if the process can - execute [file] or [Some gids] if the process can execute [file] if one - of its groups matches [gids]. If the process cannot under any - circumstances execute [file] (or if an unexpected error occurred), then - [None] is returned. *) diff --git a/src/core/opamCommonStubs.c b/src/core/opamCommonStubs.c new file mode 100644 index 00000000000..4687e5a69e6 --- /dev/null +++ b/src/core/opamCommonStubs.c @@ -0,0 +1,66 @@ +/**************************************************************************/ +/* */ +/* Copyright 2024 Kate Deplaix */ +/* */ +/* All rights reserved. This file is distributed under the terms of the */ +/* GNU Lesser General Public License version 2.1, with the special */ +/* exception on linking described in the file LICENSE. */ +/* */ +/**************************************************************************/ + +/* Needed for the Windows string conversion functions on older OCaml */ +#define CAML_INTERNALS + +#include +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 + +#include +#include + +#else + +#include + +/* mingw-w64 defines R_OK */ +#ifndef R_OK +#define R_OK 4 +#endif + +#endif + +#if OCAML_VERSION < 50000 +#define caml_unix_access unix_access +#endif + +CAMLprim value opam_is_executable(value path) +{ + CAMLparam1(path); + char_os * p; + int ret; + + caml_unix_check_path(path, "faccessat"); + p = caml_stat_strdup_to_os(String_val(path)); + caml_enter_blocking_section(); +#ifdef _WIN32 + /* No execute bit on Windows */ + ret = _waccess(p, R_OK); +#else + ret = faccessat(AT_FDCWD, p, X_OK, AT_EACCESS); +#endif + caml_leave_blocking_section(); + caml_stat_free(p); + CAMLreturn(Val_bool(ret == 0)); +} + +/* This is done here as it simplifies the dune file */ +#ifdef _WIN32 +#include "opamInject.c" +#include "opamWindows.c" +#endif diff --git a/src/stubs/win32/opamInject.c b/src/core/opamInject.c similarity index 100% rename from src/stubs/win32/opamInject.c rename to src/core/opamInject.c diff --git a/src/core/opamStd.ml b/src/core/opamStd.ml index 142ccb59e59..dcc75638677 100644 --- a/src/core/opamStd.ml +++ b/src/core/opamStd.ml @@ -1249,40 +1249,11 @@ module OpamSys = struct (* OCaml 4.05.0 no longer follows the updated PATH to resolve commands. This makes unqualified commands absolute as a workaround. *) let resolve_command = - let check_perms = - if Sys.win32 then fun f -> - try (Unix.stat f).Unix.st_kind = Unix.S_REG - with e -> fatal e; false - else fun f -> - try - let {Unix.st_uid; st_gid; st_perm; st_kind; _} = Unix.stat f in - if st_kind <> Unix.S_REG then false else - let groups = - IntSet.of_list (Unix.getegid () :: Array.to_list (Unix.getgroups ())) - in - let mask = - if Unix.geteuid () = (st_uid : int) then - 0o100 - else if IntSet.mem st_gid groups then - 0o010 - else - 0o001 - in - if (st_perm land mask) <> 0 then - true - else - match OpamACL.get_acl_executable_info f st_uid with - | None -> false - | Some [] -> true - | Some gids -> - not (IntSet.is_empty (IntSet.inter (IntSet.of_list gids) groups)) - with e -> fatal e; false - in let resolve ?dir env name = if not (Filename.is_relative name) then begin (* absolute path *) if not (Sys.file_exists name) then `Not_found - else if not (check_perms name) then `Denied + else if not (OpamStubs.is_executable name) then `Denied else `Cmd name end else if is_external_cmd name then begin (* relative path *) @@ -1291,7 +1262,7 @@ module OpamSys = struct | Some d -> Filename.concat d name in if not (Sys.file_exists cmd) then `Not_found - else if not (check_perms cmd) then `Denied + else if not (OpamStubs.is_executable cmd) then `Denied else `Cmd cmd end else (* bare command, lookup in PATH *) @@ -1305,7 +1276,7 @@ module OpamSys = struct expected name but not the right permissions are skipped silently. Therefore, only two outcomes are possible in that case, [`Cmd ..] or [`Not_found]. *) - match List.find check_perms possibles with + match List.find OpamStubs.is_executable possibles with | cmdname -> `Cmd cmdname | exception Not_found -> if possibles = [] then diff --git a/src/core/opamStubs.ocaml4.ml b/src/core/opamStubs.ocaml4.ml index 22792c62461..7763f92837c 100644 --- a/src/core/opamStubs.ocaml4.ml +++ b/src/core/opamStubs.ocaml4.ml @@ -9,9 +9,44 @@ (**************************************************************************) include OpamStubsTypes -include OpamWin32Stubs -let getpid () = Int32.to_int (getCurrentProcessID ()) +external getCurrentProcessID : unit -> int32 = "OPAMW_GetCurrentProcessID" +let getpid () = Int32.to_int (getCurrentProcessID ()) +(* Polymorphic parameters below are used as placeholders for types in + * OpamStubsTypes - it's not worth the effort of propagating the types here, + * even if it does result in some ugly-looking primitives! + *) +external getStdHandle : 'a -> 'b = "OPAMW_GetStdHandle" +external getConsoleScreenBufferInfo : 'a -> 'b = "OPAMW_GetConsoleScreenBufferInfo" +external setConsoleTextAttribute : 'a -> int -> unit = "OPAMW_SetConsoleTextAttribute" +external fillConsoleOutputCharacter : 'a -> char -> int -> int * int -> bool = "OPAMW_FillConsoleOutputCharacter" +external getConsoleMode : 'a -> int = "OPAMW_GetConsoleMode" +external setConsoleMode : 'a -> int -> bool = "OPAMW_SetConsoleMode" +external getWindowsVersion : unit -> int * int * int * int = "OPAMW_GetWindowsVersion" +external getArchitecture : unit -> 'a = "OPAMW_GetArchitecture" +external waitpids : int list -> int -> int * Unix.process_status = "OPAMW_waitpids" +external readRegistry : 'a -> string -> string -> 'b -> 'c option = "OPAMW_ReadRegistry" +external enumRegistry : 'a -> string -> 'b -> (string * 'c) list = "OPAMW_RegEnumValue" +external writeRegistry : 'a -> string -> string -> 'b -> 'c -> unit = "OPAMW_WriteRegistry" +external getConsoleOutputCP : unit -> int = "OPAMW_GetConsoleOutputCP" +external getCurrentConsoleFontEx : 'a -> bool -> 'b = "OPAMW_GetCurrentConsoleFontEx" +external create_glyph_checker : string -> 'a * 'a = "OPAMW_CreateGlyphChecker" +external delete_glyph_checker : 'a * 'a -> unit = "OPAMW_DeleteGlyphChecker" +external has_glyph : 'a * 'a -> Uchar.t -> bool = "OPAMW_HasGlyph" +external getProcessArchitecture : int32 option -> 'a = "OPAMW_GetProcessArchitecture" +external process_putenv : int32 -> string -> string -> bool = "OPAMW_process_putenv" +external getPathToHome : unit -> string = "OPAMW_GetPathToHome" +external getPathToSystem : unit -> string = "OPAMW_GetPathToSystem" +external getPathToLocalAppData : unit -> string = "OPAMW_GetPathToLocalAppData" +external sendMessageTimeout : nativeint -> int -> int -> 'a -> 'b -> 'c -> int * 'd = "OPAMW_SendMessageTimeout_byte" "OPAMW_SendMessageTimeout" +external getProcessAncestry : unit -> (int32 * string) list = "OPAMW_GetProcessAncestry" +external getConsoleAlias : string -> string -> string = "OPAMW_GetConsoleAlias" +external getConsoleWindowClass : unit -> string option = "OPAMW_GetConsoleWindowClass" +external setErrorMode : int -> int = "OPAMW_SetErrorMode" +external getErrorMode : unit -> int = "OPAMW_GetErrorMode" +external setConsoleToUTF8 : unit -> unit = "OPAMW_SetConsoleToUTF8" +external getVersionInfo : string -> 'a option = "OPAMW_GetVersionInfo" +external get_initial_environment : unit -> string list = "OPAMW_CreateEnvironmentBlock" external win_create_process : string -> string -> string option -> Unix.file_descr -> Unix.file_descr -> Unix.file_descr -> int = "win_create_process" "win_create_process_native" diff --git a/src/core/opamStubs.dummy.ml b/src/core/opamStubs.unix.ml similarity index 100% rename from src/core/opamStubs.dummy.ml rename to src/core/opamStubs.unix.ml diff --git a/src/core/opamStubsTypes.ml b/src/core/opamStubsTypes.ml index 0eb41f040d0..40667c0836e 100644 --- a/src/core/opamStubsTypes.ml +++ b/src/core/opamStubsTypes.ml @@ -8,7 +8,7 @@ (* *) (**************************************************************************) -(** Types for C stubs modules. *) +(** Types for C stubs modules and common C stubs. *) (** CONSOLE_SCREEN_BUFFER_INFO struct (see https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str) @@ -113,3 +113,8 @@ type win32_version_info = { strings: ((int * int) * win32_non_fixed_version_info) list; (** Non-fixed string table. First field is a pair of Language and Codepage ID. *) } + +external is_executable : string -> bool = "opam_is_executable" +(** faccessat on Unix; _waccess on Windows. Checks whether a path is executable + for the current process. On Unix, unlike Unix.access, this is checked using + the EUID/EGID rather than RUID/RGID. *) diff --git a/src/stubs/win32/opamWindows.c b/src/core/opamWindows.c similarity index 100% rename from src/stubs/win32/opamWindows.c rename to src/core/opamWindows.c diff --git a/src/solver/dune b/src/solver/dune index 0e00b6a5f0f..e4b897da845 100644 --- a/src/solver/dune +++ b/src/solver/dune @@ -17,4 +17,4 @@ (wrapped false)) (rule - (copy opamCudfSolverSig.ml opamCudfSolverSig.mli)) + (copy# opamCudfSolverSig.ml opamCudfSolverSig.mli)) diff --git a/src/stubs/dune b/src/stubs/dune deleted file mode 100644 index 81c80a658bd..00000000000 --- a/src/stubs/dune +++ /dev/null @@ -1,4 +0,0 @@ -(rule - (targets c-flags.sexp) - (mode fallback) - (action (with-stdout-to %{targets} (echo "()")))) diff --git a/src/stubs/libacl/c-libraries.sexp.in b/src/stubs/libacl/c-libraries.sexp.in deleted file mode 100644 index 3cb0baa5e78..00000000000 --- a/src/stubs/libacl/c-libraries.sexp.in +++ /dev/null @@ -1 +0,0 @@ -(@CONF_LIBACL_LINK@) diff --git a/src/stubs/libacl/dune-libacl b/src/stubs/libacl/dune-libacl deleted file mode 100644 index 93b27ee5833..00000000000 --- a/src/stubs/libacl/dune-libacl +++ /dev/null @@ -1,22 +0,0 @@ -(library - (name opam_stubs_libacl) - (public_name opam-core.libacl) - (synopsis "OCaml Package Manager libacl C stubs") - (flags (:standard - (:include ../../ocaml-flags-standard.sexp) - (:include ../../ocaml-flags-configure.sexp) - (:include ../../ocaml-context-flags.sexp))) - (modules opamlibACL) - (foreign_stubs - (language c) - (names opamACL) - (flags :standard - (:include ../c-flags.sexp))) - (c_library_flags :standard - (:include c-libraries.sexp)) - (wrapped false)) - -(rule - (targets c-libraries.sexp) - (mode fallback) - (action (with-stdout-to %{targets} (echo "()")))) diff --git a/src/stubs/libacl/opamACL.c b/src/stubs/libacl/opamACL.c deleted file mode 100644 index e9652868dfa..00000000000 --- a/src/stubs/libacl/opamACL.c +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright 2020 David Allsopp Ltd. */ -/* */ -/* All rights reserved. This file is distributed under the terms of the */ -/* GNU Lesser General Public License version 2.1, with the special */ -/* exception on linking described in the file LICENSE. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#define CAML_NAME_SPACE -#include -#include -#include - -#ifndef Val_none -#define Val_none Val_int(0) -#endif - -/* OPAM_get_acl_executable_info(file, owner) takes a filename and the uid of - * the file's owner (this saves a call to stat on both the OCaml and C sides). - * The result is: - * None - the process cannot execute file - * Some [] - the process can execute file - * Some gids - the process can execute file if it is any of these gids - */ -CAMLprim value OPAM_get_acl_executable_info(value file, value owner) -{ - CAMLparam2(file, owner); - CAMLlocal2(result, cell); - acl_t acl = acl_get_file(String_val(file), ACL_TYPE_ACCESS); - uid_t owner_uid = Int_val(owner); - uid_t uid = geteuid(); - - result = Val_none; - - if (acl) - { - acl_entry_t entry; - - if (acl_get_entry(acl, ACL_FIRST_ENTRY, &entry) == 1) - { - int mask = 1; - int user = 0; - do - { - acl_tag_t tag; - acl_permset_t perms; - if (acl_get_tag_type(entry, &tag) == 0 && - acl_get_permset(entry, &perms) == 0) - { - void *qualifier = NULL; - int executable = acl_get_perm(perms, ACL_EXECUTE); - - switch(tag) - { - case ACL_USER: - if (executable && (qualifier = acl_get_qualifier(entry))) - { - uid_t entry_uid = *((uid_t *)qualifier); - /* NB ACL_USER entries do not override ACL_USER_OBJ */ - if (entry_uid != owner_uid && entry_uid == uid) - { - /* result = Some [] */ - if (!Is_block(result)) - { - result = caml_alloc_small(1, 0); - Field(result, 0) = Val_int(0); - } else { - caml_modify(&Field(result, 0), Val_int(0)); - } - user = 1; - } - } - break; - case ACL_GROUP: - if (!user && executable && (qualifier = acl_get_qualifier(entry))) - { - gid_t entry_gid = *((gid_t *)qualifier); - /* Construct a cons cell */ - cell = caml_alloc_small(2, 0); - Field(cell, 0) = Val_int(entry_gid); - if (Is_block(result)) - { - /* Put cons cell at head of existing list */ - Field(cell, 1) = Field(result, 0); - caml_modify(&Field(result, 0), cell); - } - else - { - /* result = Some [cell] */ - Field(cell, 1) = Val_int(0); - result = caml_alloc_small(1, 0); - Field(result, 0) = cell; - } - } - break; - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - /* These have already been done by the stat check */ - break; - case ACL_MASK: - if (!(mask = executable)) - { - result = Val_none; - } - break; - default: - /* ACL_UNDEFINED_TAG or ACL_OTHER */ - break; - } - - if (qualifier) - acl_free(qualifier); - } - } while (mask && acl_get_entry(acl, ACL_NEXT_ENTRY, &entry) == 1); - } - - acl_free((void *)acl); - } - - CAMLreturn(result); -} diff --git a/src/stubs/libacl/opamlibACL.ml b/src/stubs/libacl/opamlibACL.ml deleted file mode 100644 index a31e7cdf30e..00000000000 --- a/src/stubs/libacl/opamlibACL.ml +++ /dev/null @@ -1,11 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright 2020 David Allsopp Ltd. *) -(* *) -(* All rights reserved. This file is distributed under the terms of the *) -(* GNU Lesser General Public License version 2.1, with the special *) -(* exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -external get_acl_executable_info : string -> int -> int list option = "OPAM_get_acl_executable_info" diff --git a/src/stubs/win32/dune-win32 b/src/stubs/win32/dune-win32 deleted file mode 100644 index 4cfc4b8e03a..00000000000 --- a/src/stubs/win32/dune-win32 +++ /dev/null @@ -1,40 +0,0 @@ -(library - (name opam_stubs_win32) - (public_name opam-core.stubs) - (synopsis "OCaml Package Manager C stubs") - (libraries unix) - (flags (:standard - (:include ../../ocaml-flags-standard.sexp) - (:include ../../ocaml-flags-configure.sexp) - (:include ../../ocaml-context-flags.sexp))) - (modules opamWin32Stubs) - (foreign_stubs - (language c) - (names opamInject opamWindows) - (flags :standard - -DUNICODE -D_UNICODE -DCAML_NAME_SPACE - (:include ../c-flags.sexp))) - (c_library_flags (:standard - (:include c-libraries.sexp))) - (wrapped false)) - -(rule - (copy opamWin32Stubs.ml opamWin32Stubs.mli)) - -(rule - (targets opam-putenv.exe) - (deps opamInject.c) - (action (run ocaml %{dep:build-putenv.ml} %{targets} %{dep:opam-putenv.c} %{dep:cc64}))) - -(rule - (targets cc64) - (mode fallback) - (action (with-stdout-to %{targets} (echo "")))) - -(install - (section bin) - (package opam) - (files opam-putenv.exe)) - -(rule - (with-stdout-to c-libraries.sexp (run ocaml %{dep:../../../shell/context_flags.ml} clibs))) diff --git a/src/stubs/win32/opamWin32Stubs.ml b/src/stubs/win32/opamWin32Stubs.ml deleted file mode 100644 index dc4c2f7ef34..00000000000 --- a/src/stubs/win32/opamWin32Stubs.ml +++ /dev/null @@ -1,46 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright 2018 MetaStack Solutions Ltd. *) -(* *) -(* All rights reserved. This file is distributed under the terms of the *) -(* GNU Lesser General Public License version 2.1, with the special *) -(* exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -external getCurrentProcessID : unit -> int32 = "OPAMW_GetCurrentProcessID" -(* Polymorphic parameters below are used as placeholders for types in - * OpamStubsTypes - it's not worth the effort of propagating the types here, - * even if it does result in some ugly-looking primitives! - *) -external getStdHandle : 'a -> 'b = "OPAMW_GetStdHandle" -external getConsoleScreenBufferInfo : 'a -> 'b = "OPAMW_GetConsoleScreenBufferInfo" -external setConsoleTextAttribute : 'a -> int -> unit = "OPAMW_SetConsoleTextAttribute" -external fillConsoleOutputCharacter : 'a -> char -> int -> int * int -> bool = "OPAMW_FillConsoleOutputCharacter" -external getConsoleMode : 'a -> int = "OPAMW_GetConsoleMode" -external setConsoleMode : 'a -> int -> bool = "OPAMW_SetConsoleMode" -external getWindowsVersion : unit -> int * int * int * int = "OPAMW_GetWindowsVersion" -external getArchitecture : unit -> 'a = "OPAMW_GetArchitecture" -external waitpids : int list -> int -> int * Unix.process_status = "OPAMW_waitpids" -external readRegistry : 'a -> string -> string -> 'b -> 'c option = "OPAMW_ReadRegistry" -external enumRegistry : 'a -> string -> 'b -> (string * 'c) list = "OPAMW_RegEnumValue" -external writeRegistry : 'a -> string -> string -> 'b -> 'c -> unit = "OPAMW_WriteRegistry" -external getConsoleOutputCP : unit -> int = "OPAMW_GetConsoleOutputCP" -external getCurrentConsoleFontEx : 'a -> bool -> 'b = "OPAMW_GetCurrentConsoleFontEx" -external create_glyph_checker : string -> 'a * 'a = "OPAMW_CreateGlyphChecker" -external delete_glyph_checker : 'a * 'a -> unit = "OPAMW_DeleteGlyphChecker" -external has_glyph : 'a * 'a -> Uchar.t -> bool = "OPAMW_HasGlyph" -external getProcessArchitecture : int32 option -> 'a = "OPAMW_GetProcessArchitecture" -external process_putenv : int32 -> string -> string -> bool = "OPAMW_process_putenv" -external getPathToHome : unit -> string = "OPAMW_GetPathToHome" -external getPathToSystem : unit -> string = "OPAMW_GetPathToSystem" -external getPathToLocalAppData : unit -> string = "OPAMW_GetPathToLocalAppData" -external sendMessageTimeout : nativeint -> int -> int -> 'a -> 'b -> 'c -> int * 'd = "OPAMW_SendMessageTimeout_byte" "OPAMW_SendMessageTimeout" -external getProcessAncestry : unit -> (int32 * string) list = "OPAMW_GetProcessAncestry" -external getConsoleAlias : string -> string -> string = "OPAMW_GetConsoleAlias" -external getConsoleWindowClass : unit -> string option = "OPAMW_GetConsoleWindowClass" -external setErrorMode : int -> int = "OPAMW_SetErrorMode" -external getErrorMode : unit -> int = "OPAMW_GetErrorMode" -external setConsoleToUTF8 : unit -> unit = "OPAMW_SetConsoleToUTF8" -external getVersionInfo : string -> 'a option = "OPAMW_GetVersionInfo" -external get_initial_environment : unit -> string list = "OPAMW_CreateEnvironmentBlock"