pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

linux-gcta -> gcta



Module Name:	pkgsrc-wip
Committed By:	Jason W. Bacon <bacon%NetBSD.org@localhost>
Pushed By:	outpaddling
Date:		Fri Oct 13 17:42:08 2023 -0500
Changeset:	1a12bbef4f1e75b2392872f49200d9a8224d4ec7

Modified Files:
	Makefile
Added Files:
	gcta/DESCR
	gcta/Makefile
	gcta/PLIST
	gcta/distinfo
	gcta/patches/patch-CMakeLists.txt
	gcta/patches/patch-include_cpu.h
	gcta/patches/patch-include_cpu__f77blas.h
	gcta/patches/patch-main_option.cpp
	gcta/patches/patch-src_Geno.cpp
	gcta/patches/patch-src_main.cpp
Removed Files:
	linux-gcta/DESCR
	linux-gcta/Makefile
	linux-gcta/PLIST
	linux-gcta/distinfo

Log Message:
linux-gcta -> gcta

Begin conversion of FreeBSD port for native build

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1a12bbef4f1e75b2392872f49200d9a8224d4ec7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                  |   2 +-
 gcta/DESCR                                |   5 ++
 gcta/Makefile                             |  40 ++++++++++++
 gcta/PLIST                                |   1 +
 gcta/distinfo                             |   8 +++
 gcta/patches/patch-CMakeLists.txt         | 100 ++++++++++++++++++++++++++++++
 gcta/patches/patch-include_cpu.h          |  20 ++++++
 gcta/patches/patch-include_cpu__f77blas.h |  20 ++++++
 gcta/patches/patch-main_option.cpp        |  30 +++++++++
 gcta/patches/patch-src_Geno.cpp           |  13 ++++
 gcta/patches/patch-src_main.cpp           |  13 ++++
 linux-gcta/DESCR                          |   5 --
 linux-gcta/Makefile                       |  32 ----------
 linux-gcta/PLIST                          |   6 --
 linux-gcta/distinfo                       |   5 --
 15 files changed, 251 insertions(+), 49 deletions(-)

diffs:
diff --git a/Makefile b/Makefile
index 52c73c414d..a55484af64 100644
--- a/Makefile
+++ b/Makefile
@@ -1090,6 +1090,7 @@ SUBDIR+=	gcc47-libs
 SUBDIR+=	gcc7-contrib
 SUBDIR+=	gcc9snapshot
 SUBDIR+=	gconf-cleaner
+SUBDIR+=	gcta
 SUBDIR+=	gdal-docs
 SUBDIR+=	gdb-git
 SUBDIR+=	gdb5
@@ -2162,7 +2163,6 @@ SUBDIR+=	linphone
 SUBDIR+=	linux-attr
 SUBDIR+=	linux-ch
 SUBDIR+=	linux-chprofessional
-SUBDIR+=	linux-gcta
 SUBDIR+=	linux-hotplug
 SUBDIR+=	linux-kbd
 SUBDIR+=	linux-kernel
diff --git a/gcta/DESCR b/gcta/DESCR
new file mode 100644
index 0000000000..6c177f5eb3
--- /dev/null
+++ b/gcta/DESCR
@@ -0,0 +1,5 @@
+GCTA (Genome-wide Complex Trait Analysis) was originally designed to estimate
+the proportion of phenotypic variance explained by genome- or chromosome-wide
+SNPs for complex traits (the GREML method), and has subsequently extended for
+many other analyses to better understand the genetic architecture of complex
+traits.
diff --git a/gcta/Makefile b/gcta/Makefile
new file mode 100644
index 0000000000..886322e297
--- /dev/null
+++ b/gcta/Makefile
@@ -0,0 +1,40 @@
+# $NetBSD$
+#
+###########################################################
+#                  Generated by fbsd2pkg                  #
+#              Fri Oct 13 17:31:07 CDT 2023               #
+###########################################################
+
+DISTNAME=	gcta-1.94.1
+CATEGORIES=	biology
+MASTER_SITES=	${MASTER_SITE_GITHUB:=jianyangqt/}
+GITHUB_TAG=	v${PKGVERSION_NOREV}
+GITHUB_SUBMODULES+=	zhilizheng plink-ng 3744540 plink/submods/plink-ng
+
+OWNER=		bacon%NetBSD.org@localhost
+HOMEPAGE=	https://cnsgenomics.com/software/gcta/index.html
+COMMENT=	Genome-wide Complex Trait Analysis
+LICENSE=	gnu-gpl-v3
+
+USE_LANGUAGES=	c c++
+
+CONFIGURE_ENV+=	EIGEN3_INCLUDE_DIR=${PREFIX}/include/eigen3
+CONFIGURE_ENV+=	BOOST_INCLUDE_DIR=${PREFIX}/include/boost
+CONFIGURE_ENV+=	OPENBLAS=${PREFIX}
+CONFIGURE_ENV+=	SPECTRA_INCLUDE_DIR=${PREFIX}/include/Spectra
+
+INSTALLATION_DIRS=	bin
+
+do-install:
+	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/gcta64 ${DESTDIR}${PREFIX}/bin
+	${RLN} ${DESTDIR}${PREFIX}/bin/gcta64 ${DESTDIR}${PREFIX}/bin/gcta
+
+.include "../../devel/cmake/build.mk"
+.include "../../mk/blas.buildlink3.mk"
+.include "../../devel/boost-libs/buildlink3.mk"
+# .include "../../wip/spectra/buildlink3.mk"
+.include "../../math/gsl/buildlink3.mk"
+.include "../../databases/sqlite3/buildlink3.mk"
+.include "../../archivers/zstd/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/gcta/PLIST b/gcta/PLIST
new file mode 100644
index 0000000000..48d96a5493
--- /dev/null
+++ b/gcta/PLIST
@@ -0,0 +1 @@
+@comment $NetBSD$
diff --git a/gcta/distinfo b/gcta/distinfo
new file mode 100644
index 0000000000..ff508c2117
--- /dev/null
+++ b/gcta/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+BLAKE2s (gcta-1.94.1.tar.gz) = 2a455f2cd8f50888fcb118704c772bb145192a24acde1b0468b14d79ec4715de
+SHA512 (gcta-1.94.1.tar.gz) = 5b41658c29ea5121b9207897092105f9ba71a5b311e07a903e36cf18fe1482016301ab80791d6fe521e1e97770cb934bd92e774908bc941662bbe292bc08c277
+Size (gcta-1.94.1.tar.gz) = 1101577 bytes
+BLAKE2s (zhilizheng-plink-ng-3744540.tar.gz) = 4eb9e46493fe628e22905f7b02f7188ce3ddda62daa8f564beee9b0e1dfdee67
+SHA512 (zhilizheng-plink-ng-3744540.tar.gz) = 0a55c3625bd5a0fb3c340fd9a22d9f5b1ebae04353652a8894a5bf427c8732afe1f38c3084f526fa9a64c46a55083a3ff8501b6f6c20641df5357772d30e1657
+Size (zhilizheng-plink-ng-3744540.tar.gz) = 3223516 bytes
diff --git a/gcta/patches/patch-CMakeLists.txt b/gcta/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..ec895755ee
--- /dev/null
+++ b/gcta/patches/patch-CMakeLists.txt
@@ -0,0 +1,100 @@
+$NetBSD$
+
+--- CMakeLists.txt.orig	2022-08-03 06:01:52 UTC
++++ CMakeLists.txt
+@@ -3,7 +3,7 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+ SET(PROJECT_NAME_STR GCTA2)
+ PROJECT(${PROJECT_NAME_STR} C CXX)
+ SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+-SET(CMAKE_CXX_STANDARD 11)
++SET(CMAKE_CXX_STANDARD 14)
+ SET(CMAKE_C_STANDARD 11)
+ 
+ # get system architecture
+@@ -16,8 +16,8 @@ endif()
+     MESSAGE(FATAL_ERROR "Use the Visual Studio project file which located in gcta_win64 directory")
+ endif()
+ 
+-if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+-    MESSAGE("Linux and Mac are supported.")
++if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
++    MESSAGE("FreeBSD, Linux and Mac are supported.")
+ else()
+     MESSAGE("Your system: ${CMAKE_SYSTEM_NAME}")
+     MESSAGE(FATAL_ERROR "Only Linux and Mac are currently supported.")
+@@ -43,18 +43,18 @@ INCLUDE_DIRECTORIES("${EIGEN3_INCLUDE_DIR}")
+ ENDIF()
+ INCLUDE_DIRECTORIES("${EIGEN3_INCLUDE_DIR}")
+ 
+-SET(SPECTRA_LIB "$ENV{SPECTRA_LIB}")
+-IF(NOT SPECTRA_LIB)
+-    MESSAGE(FATAL_ERROR "Specify environment variable SPECTRA_LIB to the location of Spectra package")
++SET(SPECTRA_INCLUDE_DIR "$ENV{SPECTRA_INCLUDE_DIR}")
++IF(NOT SPECTRA_INCLUDE_DIR)
++    MESSAGE(FATAL_ERROR "Specify environment variable SPECTRA_INCLUDE_DIR to the location of Spectra package")
+ ENDIF()
+-INCLUDE_DIRECTORIES("${SPECTRA_LIB}")
++INCLUDE_DIRECTORIES("${SPECTRA_INCLUDE_DIR}")
+ 
+ 
+-SET(BOOST_LIB "$ENV{BOOST_LIB}")
+-IF(NOT BOOST_LIB)
+-    MESSAGE(FATAL_ERROR "Specify environment variable BOOST_LIB to the location of BOOST library")
++SET(BOOST_INCLUDE_DIR "$ENV{BOOST_INCLUDE_DIR}")
++IF(NOT BOOST_INCLUDE_DIR)
++    MESSAGE(FATAL_ERROR "Specify environment variable BOOST_INCLUDE_DIR to the location of BOOST headers")
+ ENDIF()
+-INCLUDE_DIRECTORIES("${BOOST_LIB}")
++INCLUDE_DIRECTORIES("${BOOST_INCLUDE_DIR}")
+ 
+ 
+ # PLINK2.0 pgen library;
+@@ -63,13 +63,28 @@ message(STATUS "ARCHITECTURE:${CMAKE_LIBRARY_ARCHITECT
+ 
+ 
+ message(STATUS "ARCHITECTURE:${CMAKE_LIBRARY_ARCHITECTURE}")
+-if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "aarch64")
++if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
+     SET(OPENBLAS "$ENV{OPENBLAS}")
+     IF(NOT OPENBLAS)
+         MESSAGE(FATAL_ERROR "Specify environment variable OPENBLAS to the location of OPENBLAS package")
+     ENDIF()
+     INCLUDE_DIRECTORIES("${OPENBLAS}/include")
+ 
++    find_library(lib_openblas NAMES openblas PATHS "${OPENBLAS}" "${LOCALBASE}/lib")
++    set(BLAS_LIB ${lib_openblas})
++
++    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
++    set(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
++    set(CMAKE_CXX_FLAGS_DEBUG  "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
++    add_compile_options(-fopenmp)
++
++elseif(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "aarch64")
++    SET(OPENBLAS "$ENV{OPENBLAS}")
++    IF(NOT OPENBLAS)
++        MESSAGE(FATAL_ERROR "Specify environment variable OPENBLAS to the location of OPENBLAS package")
++    ENDIF()
++    INCLUDE_DIRECTORIES("${OPENBLAS}/include")
++
+     find_library(lib_openblas NAMES openblas PATHS "${OPENBLAS}" "${OPENBLAS}/lib")
+     set(BLAS_LIB ${lib_openblas})
+ 
+@@ -169,6 +184,8 @@ if(APPLE)
+ if(APPLE)
+     link_directories(${MKLROOT}/lib)
+     link_directories(/usr/local/lib)
++elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
++    link_directories(${LOCALBASE}/lib)
+ else(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+     #linux
+     link_directories(${MKLROOT}/../../../lib/intel64)
+@@ -179,6 +196,9 @@ if(APPLE)
+ if(APPLE)
+     # iomp5
+     target_link_libraries(gcta64 ${libs_list} Pgenlib mainV1 z ${BLAS_LIB} sqlite3 zstd_s omp pthread m dl )
++elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
++    # FIXME: Clean this up
++    target_link_libraries(gcta64 mainV1 ${libs_list} Pgenlib gsl z sqlite3 zstd -Wl,--start-group ${BLAS_LIB} -Wl,--end-group -Wl,--whole-archive -lpthread -Wl,--no-whole-archive m dl)
+ else()
+     if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+         # error keeps only
diff --git a/gcta/patches/patch-include_cpu.h b/gcta/patches/patch-include_cpu.h
new file mode 100644
index 0000000000..0a6f065d0b
--- /dev/null
+++ b/gcta/patches/patch-include_cpu.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- include/cpu.h.orig	2023-10-13 13:09:13 UTC
++++ include/cpu.h
+@@ -13,7 +13,7 @@
+   #define GCTA_ARCH_i386 0
+ #endif
+ 
+-#if GCTA_ARCH_x86_64 || GCTA_ARCH_i386
++#if !defined(__FreeBSD__) && (GCTA_ARCH_x86_64 || GCTA_ARCH_i386)
+   #define GCTA_CPU_x86 1
+ #else
+   #define GCTA_CPU_x86 0
+@@ -50,4 +50,4 @@
+   #include <lapack.h>
+ #endif
+ 
+-#endif  //END GCTA_CPU_H
+\ No newline at end of file
++#endif  //END GCTA_CPU_H
diff --git a/gcta/patches/patch-include_cpu__f77blas.h b/gcta/patches/patch-include_cpu__f77blas.h
new file mode 100644
index 0000000000..b5e207e9e7
--- /dev/null
+++ b/gcta/patches/patch-include_cpu__f77blas.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- include/cpu_f77blas.h.orig	2023-10-13 13:10:15 UTC
++++ include/cpu_f77blas.h
+@@ -13,7 +13,7 @@
+   #define GCTA_ARCH_i386 0
+ #endif
+ 
+-#if GCTA_ARCH_x86_64 || GCTA_ARCH_i386
++#if !defined(__FreeBSD__) && (GCTA_ARCH_x86_64 || GCTA_ARCH_i386)
+   #define GCTA_CPU_x86 1
+ #else
+   #define GCTA_CPU_x86 0
+@@ -46,4 +46,4 @@
+   #include <f77blas.h>
+ #endif
+ 
+-#endif  //END GCTA_F77BLAS_CPU_H
+\ No newline at end of file
++#endif  //END GCTA_F77BLAS_CPU_H
diff --git a/gcta/patches/patch-main_option.cpp b/gcta/patches/patch-main_option.cpp
new file mode 100644
index 0000000000..19e70358aa
--- /dev/null
+++ b/gcta/patches/patch-main_option.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- main/option.cpp.orig	2023-10-13 13:49:25 UTC
++++ main/option.cpp
+@@ -1112,10 +1112,10 @@ void option(int option_num, char* option_str[])
+ 
+ #ifdef _WIN32
+ 	    if(chbuf != '\\') ref_ld_dirt = ref_ld_dirt + '\\';
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __FreeBSD__ || defined __linux__ || defined __APPLE__
+ 	    if(chbuf != '/') ref_ld_dirt = ref_ld_dirt + '/';
+ #else
+-#error Only Windows, Mac and Linux are supported.
++#error Only FreeBSD, Windows, Mac and Linux are supported.
+ #endif
+             LOGGER << "--ref-ld-chr " << ref_ld_dirt << endl;
+         } else if (strcmp(argv[i], "--w-ld-chr") == 0) {
+@@ -1124,10 +1124,10 @@ void option(int option_num, char* option_str[])
+             chbuf = w_ld_dirt.back();
+ #ifdef _WIN32
+             if(chbuf != '\\') w_ld_dirt = w_ld_dirt + '\\';
+-#elif defined __linux__ || defined __APPLE__
++#elif defined __FreeBSD__ || defined __linux__ || defined __APPLE__
+             if(chbuf != '/') w_ld_dirt = w_ld_dirt + '/';
+ #else
+-#error Only Windows, Mac and Linux are supported.
++#error Only FreeBSD, Windows, Mac and Linux are supported.
+ #endif
+ 
+             LOGGER << "--w-ld-chr " << w_ld_dirt << endl;
diff --git a/gcta/patches/patch-src_Geno.cpp b/gcta/patches/patch-src_Geno.cpp
new file mode 100644
index 0000000000..8b2ac1f7a4
--- /dev/null
+++ b/gcta/patches/patch-src_Geno.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/Geno.cpp.orig	2022-08-03 06:01:52 UTC
++++ src/Geno.cpp
+@@ -2948,7 +2948,7 @@ void Geno::bgen2bed(const vector<uint32_t> &raw_marker
+         }
+         //LOGGER.i(0, "MIDDLE: " + to_string(index) + "NUM_thread: " + to_string(omp_get_max_threads()));
+ 
+-        #pragma omp ordered
++        // Conflict with previous on 2759 #pragma omp ordered
+         save_bed(buf, num_marker);
+         delete[] buf;
+         delete[] dec_data;
diff --git a/gcta/patches/patch-src_main.cpp b/gcta/patches/patch-src_main.cpp
new file mode 100644
index 0000000000..aaa7477b76
--- /dev/null
+++ b/gcta/patches/patch-src_main.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/main.cpp.orig	2023-10-13 13:46:01 UTC
++++ src/main.cpp
+@@ -226,7 +226,7 @@ int main(int argc, char *argv[]){
+ 
+     #ifdef _WIN32
+        _putenv_s("OMP_NUM_THREADS", to_string(thread_num).c_str());
+-    #elif defined __linux__ || defined __APPLE__
++    #elif defined __FreeBSD__ || defined __linux__ || defined __APPLE__
+         setenv("OMP_NUM_THREADS", to_string(thread_num).c_str(), 1);
+     #else
+         #error Only Windows, Mac and Linux are supported.
diff --git a/linux-gcta/DESCR b/linux-gcta/DESCR
deleted file mode 100644
index 6c177f5eb3..0000000000
--- a/linux-gcta/DESCR
+++ /dev/null
@@ -1,5 +0,0 @@
-GCTA (Genome-wide Complex Trait Analysis) was originally designed to estimate
-the proportion of phenotypic variance explained by genome- or chromosome-wide
-SNPs for complex traits (the GREML method), and has subsequently extended for
-many other analyses to better understand the genetic architecture of complex
-traits.
diff --git a/linux-gcta/Makefile b/linux-gcta/Makefile
deleted file mode 100644
index 5e549765e3..0000000000
--- a/linux-gcta/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# $NetBSD$
-#
-###########################################################
-#                  Generated by fbsd2pkg                  #
-#              Tue Mar 14 11:21:21 CDT 2017               #
-###########################################################
-
-DISTNAME=	gcta_${PORTVERSION}beta
-PKGNAME=	linux-gcta-${PORTVERSION}
-CATEGORIES=	biology
-MASTER_SITES=	https://cnsgenomics.com/software/gcta/bin/
-EXTRACT_SUFX=	.zip
-
-MAINTAINER=	bacon%NetBSD.org@localhost
-HOMEPAGE=	http://cnsgenomics.com/software/gcta/index.html
-COMMENT=	Tool for Genome-wide Complex Trait Analysis
-LICENSE=	mit
-
-NO_BUILD=	yes
-
-USE_TOOLS=	unzip
-
-PORTVERSION=	1.93.1
-DATADIR=	${PREFIX}/share/gcta
-
-INSTALLATION_DIRS=	bin ${DATADIR}
-
-do-install:
-	${INSTALL_SCRIPT} ${WRKSRC}/gcta64 ${DESTDIR}${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/test.* ${DESTDIR}${DATADIR}
-
-.include "../../mk/bsd.pkg.mk"
diff --git a/linux-gcta/PLIST b/linux-gcta/PLIST
deleted file mode 100644
index b1cfb6b91c..0000000000
--- a/linux-gcta/PLIST
+++ /dev/null
@@ -1,6 +0,0 @@
-@comment $NetBSD$
-bin/gcta64
-share/gcta/test.bed
-share/gcta/test.bim
-share/gcta/test.fam
-share/gcta/test.phen
diff --git a/linux-gcta/distinfo b/linux-gcta/distinfo
deleted file mode 100644
index 6f6b31040e..0000000000
--- a/linux-gcta/distinfo
+++ /dev/null
@@ -1,5 +0,0 @@
-$NetBSD$
-
-RMD160 (gcta_1.93.1beta.zip) = b7d5ba8fa9d89fa220ee6560056a0357888ceb78
-SHA512 (gcta_1.93.1beta.zip) = 5d38d60805738ce2f78a0743638a7602fdfc22f094b9340ea995fa30dc0553a2970f965342da4aec6aed21451850be645efb2c6be89ab609d2552ef6b8672222
-Size (gcta_1.93.1beta.zip) = 12054916 bytes


Home | Main Index | Thread Index | Old Index