Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkgs/development/interpreters/tcl/8.6.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{ callPackage, fetchurl, ... }@args:
{
lib,
stdenv,
callPackage,
fetchurl,
...
}@args:

callPackage ./generic.nix (
args
Expand All @@ -12,5 +18,7 @@ callPackage ./generic.nix (
url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz";
hash = "sha256-kcuPphdxxjwmLvtVMFm3x61nV6+lhXr2Jl5LC9wqFKU=";
};

patches = lib.optional stdenv.hostPlatform.isCygwin ./fix-cygwin-build.patch;
}
)
79 changes: 79 additions & 0 deletions pkgs/development/interpreters/tcl/fix-cygwin-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
diff --git a/generic/tcl.h b/generic/tcl.h
index fc772d5b3c..3227398c57 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -462,22 +462,6 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
# else
typedef struct _stat32i64 Tcl_StatBuf;
# endif /* _MSC_VER < 1400 */
-#elif defined(__CYGWIN__)
- typedef struct {
- unsigned st_dev;
- unsigned short st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- /* Here is a 2-byte gap */
- unsigned st_rdev;
- /* Here is a 4-byte gap */
- long long st_size;
- struct {long tv_sec;} st_atim;
- struct {long tv_sec;} st_mtim;
- struct {long tv_sec;} st_ctim;
- } Tcl_StatBuf;
#elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
typedef struct stat64 Tcl_StatBuf;
#else
diff --git a/unix/Makefile.in b/unix/Makefile.in
index bc743b3892..be0a207c93 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -637,9 +637,6 @@ ${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS}
@MAKE_LIB@

${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
- @if test "x${LIB_FILE}" = "xlibtcl${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \
- (cd ${TOP_DIR}/win; ${MAKE} winextensions); \
- fi
rm -f $@
@MAKE_STUB_LIB@

diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 7f5464e651..88bcd93c52 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1185,7 +1185,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
;;
CYGWIN_*|MINGW32_*|MSYS_*)
SHLIB_CFLAGS="-fno-common"
- SHLIB_LD='${CC} -shared'
+ SHLIB_LD='${CC} -shared -Wl,--out-implib,$(patsubst %.dll,%.dll.a,[$]@)'
SHLIB_SUFFIX=".dll"
DL_OBJS="tclLoadDl.o"
PLAT_OBJS='${CYGWIN_OBJS}'
@@ -1210,15 +1210,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads])
fi
do64bit_ok=yes
- if test "x${SHARED_BUILD}" = "x1"; then
- echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32"
- # The eval makes quoting arguments work.
- if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix
- then :
- else
- { echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
- fi
- fi
;;
dgux*)
SHLIB_CFLAGS="-K PIC"
@@ -2002,7 +1993,7 @@ dnl # preprocessing tests use only CPPFLAGS.
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
+ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)" && $(INSTALL_LIBRARY) $(LIB_FILE).a "$(LIB_INSTALL_DIR)/$(LIB_FILE).a"'
DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
], [
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
31 changes: 25 additions & 6 deletions pkgs/development/interpreters/tcl/generic.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
lib,
stdenv,
autoreconfHook,
callPackage,
deterministic-host-uname,
makeSetupHook,
runCommand,
tzdata,
Expand All @@ -12,6 +14,7 @@
release,
version,
src,
patches ? [ ],
extraPatch ? "",
...
}:
Expand All @@ -28,6 +31,8 @@ let

setOutputFlags = false;

inherit patches;

postPatch = ''
substituteInPlace library/clock.tcl \
--replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" \
Expand All @@ -37,15 +42,22 @@ let
''
+ extraPatch;

nativeBuildInputs = lib.optionals (lib.versionAtLeast version "9.0") [
# Only used to detect the presence of zlib. Could be replaced with a stub.
zip
];
nativeBuildInputs =
lib.optionals (lib.versionAtLeast version "9.0") [
# Only used to detect the presence of zlib. Could be replaced with a stub.
zip
]
++ lib.optional (
!lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform
) deterministic-host-uname
++ lib.optional stdenv.hostPlatform.isCygwin autoreconfHook;

buildInputs = lib.optionals (lib.versionAtLeast version "9.0") [
zlib
];

autoreconfFlags = if stdenv.hostPlatform.isCygwin then "unix" else null;

preConfigure = ''
cd unix
'';
Expand Down Expand Up @@ -108,18 +120,25 @@ let
let
dllExtension = stdenv.hostPlatform.extensions.sharedLibrary;
staticExtension = stdenv.hostPlatform.extensions.staticLibrary;
exeExtension = stdenv.hostPlatform.extensions.executable;
dllDir = if stdenv.hostPlatform.isCygwin then "bin" else "lib";
in
''
make install-private-headers
ln -s $out/bin/tclsh${release} $out/bin/tclsh
ln -s $out/bin/tclsh${release}${exeExtension} $out/bin/tclsh${exeExtension}
if [[ -e $out/lib/libtcl${release}${staticExtension} ]]; then
ln -s $out/lib/libtcl${release}${staticExtension} $out/lib/libtcl${staticExtension}
fi
${lib.optionalString (!stdenv.hostPlatform.isStatic) ''
ln -s $out/lib/libtcl${release}${dllExtension} $out/lib/libtcl${dllExtension}
ln -s $out/${dllDir}/libtcl${release}${dllExtension} $out/${dllDir}/libtcl${dllExtension}
''}
''
+ lib.optionalString stdenv.hostPlatform.isCygwin ''
ln -s $out/lib/libtcl${release}.dll${staticExtension} $out/lib/libtcl.dll${staticExtension}
'';

allowedImpureDLLs = [ "USER32.dll" ];

meta = {
description = "Tcl scripting language";
homepage = "https://www.tcl.tk/";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/libraries/sqlite/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ stdenv.mkDerivation rec {
ncurses
];

patches = lib.optional (stdenv.hostPlatform.extensions.executable != "") ./fix-target-exeext.patch;

# required for aarch64 but applied for all arches for simplicity
preConfigure = ''
patchShebangs configure
Expand Down
15 changes: 15 additions & 0 deletions pkgs/development/libraries/sqlite/fix-target-exeext.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 384275f..c30b052 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -1994,8 +1994,8 @@ proc sqlite-check-tcl {} {
proj-assert {"" ne $tclExecPrefix}
msg-result "AFTER4"
set tryThese [list \
- $tclExecPrefix/bin/tclsh[get-define TCL_VERSION] \
- $tclExecPrefix/bin/tclsh ]
+ $tclExecPrefix/bin/tclsh[get-define TCL_VERSION][get-define TARGET_EXEEXT] \
+ $tclExecPrefix/bin/tclsh[get-define TARGET_EXEEXT] ]
foreach trySh $tryThese {
if {[file-isexec $trySh]} {
set with_tclsh $trySh
Loading