aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ehlert <28669218+awvwgk@users.noreply.github.com>2020-11-29 12:53:38 +0100
committerSebastian Ehlert <28669218+awvwgk@users.noreply.github.com>2020-12-10 18:47:51 +0100
commit738300b515d5e9a9630a3e4abed72d728bcdaa3b (patch)
tree07619bfdc7c140f5a587acb92185ddd82a5d957c
parent4977652445ebecd595a32cf70ae3be56759ea57a (diff)
downloadfpm-738300b515d5e9a9630a3e4abed72d728bcdaa3b.tar.gz
fpm-738300b515d5e9a9630a3e4abed72d728bcdaa3b.zip
Let fpm install itself on CI-runs
-rwxr-xr-xci/run_tests.bat6
-rwxr-xr-xci/run_tests.sh10
-rw-r--r--fpm/src/fpm/installer.f9010
3 files changed, 25 insertions, 1 deletions
diff --git a/ci/run_tests.bat b/ci/run_tests.bat
index 42f391c..ef4a1f2 100755
--- a/ci/run_tests.bat
+++ b/ci/run_tests.bat
@@ -26,6 +26,12 @@ echo %fpm_path%
%fpm_path%
if errorlevel 1 exit 1
+%fpm_path% build
+if errorlevel 1 exit 1
+
+%fpm_path% install --prefix "%CD%\_dist" --no-rebuild
+if errorlevel 1 exit 1
+
cd ..\example_packages\hello_world
if errorlevel 1 exit 1
diff --git a/ci/run_tests.sh b/ci/run_tests.sh
index 7412fba..8229d54 100755
--- a/ci/run_tests.sh
+++ b/ci/run_tests.sh
@@ -15,12 +15,20 @@ rm -rf fpm_scratch_*/
fpm test $@
rm -rf fpm_scratch_*/
-# Build example packages
f_fpm_path="$(fpm run $@ --runner echo)"
+
+# Let fpm build itself
+"${f_fpm_path}" build
+
+# Install fpm into local directory
+"${f_fpm_path}" install --prefix "$PWD/_dist" --no-rebuild
+
+# Build example packages
cd ../example_packages/
rm -rf ./*/build
cd hello_world
+
"${f_fpm_path}" build
./build/gfortran_debug/app/hello_world
"${f_fpm_path}" run
diff --git a/fpm/src/fpm/installer.f90 b/fpm/src/fpm/installer.f90
index 5ef471b..1d2341c 100644
--- a/fpm/src/fpm/installer.f90
+++ b/fpm/src/fpm/installer.f90
@@ -137,8 +137,18 @@ contains
character(len=*), intent(in) :: executable
!> Error handling
type(error_t), allocatable, intent(out) :: error
+ integer :: ll
+
+ if (.not.os_is_unix(self%os)) then
+ ll = len(executable)
+ if (executable(max(1, ll-3):ll) /= ".exe") then
+ call self%install(executable//".exe", self%bindir, error)
+ return
+ end if
+ end if
call self%install(executable, self%bindir, error)
+
end subroutine install_executable
!> Install a library in its correct subdirectory