Skip to content

Commit d9dc9f2

Browse files
authored
Phase out Haskell fpm (fortran-lang#420)
- remove bootstrap directory from repository - remove stack-build from CI workflow - move Fortran fpm to project root - adjust install script and bootstrap instructions
1 parent 5422ec5 commit d9dc9f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+39
-2922
lines changed

.github/workflows/CI.yml

+1-142
Original file line numberDiff line numberDiff line change
@@ -13,138 +13,8 @@ env:
1313
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
1414
HOMEBREW_NO_GITHUB_API: "ON"
1515
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
16-
RUST_BACKTRACE: "full" # Make Rust print full backtrace on error
1716

1817
jobs:
19-
stack-build:
20-
runs-on: ${{ matrix.os }}
21-
strategy:
22-
fail-fast: false
23-
matrix:
24-
os: [ubuntu-latest, macos-latest, windows-latest]
25-
gcc_v: [9] # Version of GFortran we want to use.
26-
include:
27-
- os: ubuntu-latest
28-
STACK_CACHE: "/home/runner/.stack/"
29-
STACK_CACHE_VERSION: ""
30-
TEST_SCRIPT: ci/run_tests.sh
31-
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
32-
CHECK_VERSION_CMD: grep $(cat fpm_version)
33-
RELEASE_CMD: "cp -- fpm-$(cat fpm_version)-linux-x86_64"
34-
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-haskell-$(cat fpm_version)-linux-x86_64
35-
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
36-
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3
37-
38-
- os: macos-latest
39-
STACK_CACHE: |
40-
/Users/runner/.stack/snapshots
41-
/Users/runner/.stack/setup-exe-src
42-
STACK_CACHE_VERSION: "v2"
43-
TEST_SCRIPT: ci/run_tests.sh
44-
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
45-
CHECK_VERSION_CMD: grep $(cat fpm_version)
46-
RELEASE_CMD: "cp -- fpm-$(cat fpm_version)-macos-x86_64"
47-
BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-haskell-$(cat fpm_version)-macos-x86_64
48-
HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
49-
RELEASE_FLAGS: --flag -g --flag -fbacktrace --flag -O3
50-
51-
- os: windows-latest
52-
STACK_CACHE: |
53-
C:\Users\runneradmin\AppData\Roaming\stack
54-
C:\Users\runneradmin\AppData\Local\Programs\stack
55-
STACK_CACHE_VERSION: "v2"
56-
TEST_SCRIPT: ci\run_tests.bat
57-
GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
58-
CHECK_VERSION_CMD: Select-String -Pattern Version | Where-Object { if ($_ -like -join("*",(Get-Content fpm_version),"*")) {echo $_} else {Throw} }
59-
RELEASE_CMD: copy -- (-join("fpm-",(Get-Content fpm_version),"-windows-x86_64.exe"))
60-
BOOTSTRAP_RELEASE_CMD: copy C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe (-join("fpm-haskell-",(Get-Content fpm_version),"-windows-x86_64.exe"))
61-
HASH_CMD: Get-ChildItem -File -Filter "fpm-*" | Foreach-Object {echo (Get-FileHash -Algorithm SHA256 $PSItem | Select-Object hash | Format-Table -HideTableHeaders | Out-String) > (-join($PSItem,".sha256"))}
62-
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3
63-
64-
env:
65-
FC: gfortran
66-
GCC_V: ${{ matrix.gcc_v }}
67-
68-
steps:
69-
- name: Checkout code
70-
uses: actions/checkout@v1
71-
72-
- name: Install GFortran macOS
73-
if: contains(matrix.os, 'macos')
74-
run: |
75-
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
76-
which gfortran-${GCC_V}
77-
which gfortran
78-
79-
- name: Install GFortran Linux
80-
if: contains(matrix.os, 'ubuntu')
81-
run: |
82-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
83-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
84-
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
85-
86-
- name: Get Time
87-
id: time
88-
uses: nanzm/[email protected]
89-
with:
90-
format: 'YYYY-MM'
91-
92-
- name: Setup github actions cache
93-
id: cache
94-
uses: actions/cache@v2
95-
with:
96-
path: ${{matrix.STACK_CACHE}}
97-
key: ${{ runner.os }}-${{ steps.time.outputs.time }}${{matrix.STACK_CACHE_VERSION}}
98-
99-
- name: Build Haskell fpm
100-
run: |
101-
stack build
102-
stack install
103-
working-directory: bootstrap
104-
105-
- name: put fpm to PATH (macOS)
106-
if: contains(matrix.os, 'macos')
107-
run: |
108-
cp /Users/runner/.local/bin/fpm /usr/local/bin
109-
110-
- name: put fpm to PATH (Windows)
111-
if: contains(matrix.os, 'windows')
112-
run: |
113-
copy "C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe" "C:\Program Files\Git\usr\bin"
114-
115-
- name: put fpm to PATH (Linux)
116-
if: contains(matrix.os, 'ubuntu')
117-
run: |
118-
sudo cp /home/runner/.local/bin/fpm /usr/local/bin
119-
120-
- name: Run tests on Haskell fpm
121-
run: |
122-
stack test
123-
working-directory: bootstrap
124-
125-
# ----- Upload binaries if creating a release -----
126-
- name: Check that fpm --version matches release tag
127-
if: github.event_name == 'release'
128-
run: |
129-
${{ matrix.GET_VERSION_CMD }} > fpm_version
130-
working-directory: fpm
131-
132-
- name: Stage release files for upload
133-
if: github.event_name == 'release'
134-
run: |
135-
${{ matrix.BOOTSTRAP_RELEASE_CMD }}
136-
${{ matrix.HASH_CMD }}
137-
working-directory: fpm
138-
139-
- name: Upload assets
140-
if: github.event_name == 'release'
141-
uses: svenstaro/upload-release-action@v2
142-
with:
143-
repo_token: ${{ secrets.GITHUB_TOKEN }}
144-
file: fpm/fpm-*
145-
file_glob: true
146-
tag: ${{ github.ref }}
147-
overwrite: true
14818

14919
build:
15020
runs-on: ${{ matrix.os }}
@@ -208,27 +78,23 @@ jobs:
20878
shell: bash
20979
run: |
21080
${{ env.BOOTSTRAP }} build
211-
working-directory: fpm
21281
21382
- name: Run Fortran fpm (bootstrap)
21483
shell: bash
21584
run: |
21685
${{ env.BOOTSTRAP }} run
21786
${{ env.BOOTSTRAP }} run -- --version
21887
${{ env.BOOTSTRAP }} run -- --help
219-
working-directory: fpm
22088
22189
- name: Test Fortran fpm (bootstrap)
22290
shell: bash
22391
run: |
22492
${{ env.BOOTSTRAP }} test
225-
working-directory: fpm
22693
22794
- name: Install Fortran fpm (bootstrap)
22895
shell: bash
22996
run: |
23097
${{ env.BOOTSTRAP }} install
231-
working-directory: fpm
23298
23399
# Phase 2: Bootstrap fpm with itself
234100
- name: Replace bootstrapping version
@@ -237,7 +103,6 @@ jobs:
237103
${{ env.BOOTSTRAP }} run --runner cp -- fpm-debug${{ matrix.exe }}
238104
rm -v ${{ env.BOOTSTRAP }}
239105
echo "FPM=$PWD/fpm-debug" | cat >> $GITHUB_ENV
240-
working-directory: fpm
241106
242107
- name: Get version (normal)
243108
if: github.event_name != 'release'
@@ -266,35 +131,30 @@ jobs:
266131
shell: bash
267132
run: |
268133
${{ env.FPM }} build ${{ matrix.release-flags }}
269-
working-directory: fpm
270134
271135
- name: Run Fortran fpm
272136
shell: bash
273137
run: |
274138
${{ env.FPM }} run ${{ matrix.release-flags }}
275139
${{ env.FPM }} run ${{ matrix.release-flags }} -- --version
276140
${{ env.FPM }} run ${{ matrix.release-flags }} -- --help
277-
working-directory: fpm
278141
279142
- name: Test Fortran fpm
280143
shell: bash
281144
run: |
282145
${{ env.FPM }} test ${{ matrix.release-flags }}
283-
working-directory: fpm
284146
285147
- name: Install Fortran fpm
286148
shell: bash
287149
run: |
288150
${{ env.FPM }} install ${{ matrix.release-flags }}
289-
working-directory: fpm
290151
291152
- name: Package release version
292153
shell: bash
293154
run: |
294155
${{ env.FPM }} run ${{ matrix.release-flags }} --runner cp -- ${{ env.EXE }}
295156
rm -v ${{ env.FPM }}
296157
echo "FPM_RELEASE=$PWD/${{ env.EXE }}" | cat >> $GITHUB_ENV
297-
working-directory: fpm
298158
env:
299159
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }}
300160

@@ -308,14 +168,13 @@ jobs:
308168
shell: bash
309169
run: |
310170
${{ matrix.sha256sum }} ${{ env.FPM_RELEASE }} > ${{ env.FPM_RELEASE }}.sha256
311-
working-directory: fpm
312171
313172
- name: Upload assets
314173
if: github.event_name == 'release'
315174
uses: svenstaro/upload-release-action@v2
316175
with:
317176
repo_token: ${{ secrets.GITHUB_TOKEN }}
318-
file: fpm/fpm-*
177+
file: fpm-*
319178
file_glob: true
320179
tag: ${{ github.ref }}
321180
overwrite: true

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
.stack-work/
2-
fpm.cabal
3-
*~
1+
build/*

README.md

+20-28
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ matures and we enter production, we will aim to stay backwards compatible.
1818
Please follow the [issues](https://github.com/fortran-lang/fpm/issues) to
1919
contribute and/or stay up to date with the development.
2020
Before opening a bug report or a feature suggestion, please read our
21-
[Contributor Guide](CONTRIBUTING.md). You can also discuss your ideas and queries with the community in [fpm discussions](https://github.com/fortran-lang/fpm/discussions), or more broadly on [Fortran-Lang Discourse](https://fortran-lang.discourse.group/)
21+
[Contributor Guide](CONTRIBUTING.md). You can also discuss your ideas and
22+
queries with the community in
23+
[fpm discussions](https://github.com/fortran-lang/fpm/discussions),
24+
or more broadly on [Fortran-Lang Discourse](https://fortran-lang.discourse.group/).
2225

2326
Fortran Package Manager is not to be confused with
2427
[Jordan Sissel's fpm](https://github.com/jordansissel/fpm), a more general,
@@ -71,8 +74,8 @@ with the following contents and initialized as a git repository.
7174
* `README.md` – with your project’s name
7275
* `.gitignore`
7376
* `src/project_name.f90` – with a simple hello world subroutine
74-
* `app/main.f90` (if `--with-executable` flag used) – a program that calls the subroutine
75-
* `test/main.f90` (if `--with-test` flag used) – an empty test program
77+
* `app/main.f90` (if `--app` flag used) – a program that calls the subroutine
78+
* `test/main.f90` (if `--test` flag used) – an empty test program
7679

7780
### Building your Fortran project with fpm
7881

@@ -81,6 +84,7 @@ with the following contents and initialized as a git repository.
8184
* `fpm build` – build your library, executables and tests
8285
* `fpm run` – run executables
8386
* `fpm test` – run tests
87+
* `fpm install` - installs the executables locally
8488

8589
The command `fpm run` can optionally accept the name of the specific executable
8690
to run, as can `fpm test`; like `fpm run specific_executable`. Command line
@@ -94,36 +98,24 @@ the [manifest reference](manifest-reference.md).
9498
### Bootstrapping instructions
9599

96100
This guide explains the process of building *fpm* on a platform for the first time.
97-
If your platform and architecture are already supported, download the binary from the [release page](https://github.com/fortran-lang/fpm/releases) instead.
101+
To build *fpm* without a prior *fpm* version a single source file version is available
102+
at each release.
98103

99-
#### Download this repository
104+
To build manually using the single source distribution use
100105

101-
```bash
102-
$ git clone https://github.com/fortran-lang/fpm
103-
$ cd fpm/
104106
```
105-
106-
#### Build a bootstrap version of fpm
107-
108-
You can use the install script to bootstrap and install *fpm*:
109-
110-
```bash
111-
$ ./install.sh
107+
mkdir _tmp
108+
curl -LJ https://github.com/fortran-lang/fpm/releases/download/v0.2.0/fpm-0.2.0.f90 > _tmp/fpm.f90
109+
gfortran -J _tmp _tmp/fpm.f90 -o _tmp/fpm
110+
_tmp/fpm install --flag "-g -fbacktrace -O3"
111+
rm -r _tmp
112112
```
113113

114-
By default, the above command installs `fpm` to `${HOME}/.local/bin/`.
115-
To specify an alternative destination use the `--prefix=` flag, for example:
114+
To automatically bootstrap using this appoach run the install script
116115

117-
```bash
118-
$ ./install.sh --prefix=/usr/local
119116
```
120-
121-
which will install *fpm* to `/usr/local/bin`.
122-
123-
To test that everything is working as expected you can now build *fpm*
124-
with itself and run the tests with:
125-
126-
```bash
127-
$ cd fpm
128-
$ fpm test
117+
./install.sh
129118
```
119+
120+
You can set your Fortran compiler and the compiler flags with the ``FC`` and ``FFLAGS``
121+
environment variables.

fpm/app/main.f90 app/main.f90

File renamed without changes.

bootstrap/Setup.hs

-2
This file was deleted.

bootstrap/app/Main.hs

-8
This file was deleted.

bootstrap/package.yaml

-72
This file was deleted.

0 commit comments

Comments
 (0)