Skip to content

Commit

Permalink
Clean up make scripts a little, also simplifies readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alcaro committed Sep 3, 2024
1 parent e12ef18 commit 6267f57
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 72 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Third-party forks, or separate tools, covering usecases this version doesn't (th

Compilation - Linux:
- `sudo apt-get install g++ build-essential`; for GUI support, also `sudo apt-get install libgtk-3-dev pkg-config`; adjust for your distro if necessary
- `./make-linux.sh` to build an optimized binary; for development, use `make CFLAGS=-g` (ignore make-maintainer.sh)
- `./make-linux.sh` to build an optimized binary; for development, use `make CFLAGS=-g`

Compilation - OSX, other Unix, or anything else with a C++ compiler:
- Install a C++ compiler
Expand All @@ -31,7 +31,7 @@ Compilation - OSX, other Unix, or anything else with a C++ compiler:

Compilation - Windows:
- Install [mingw-w64](https://winlibs.com/), or similar
- `mingw32-make CFLAGS=-O3` (GUI is automatically enabled), or extract the appropriate optimization commands from make-linux.sh
- `mingw32-make CFLAGS=-g` (GUI is automatically enabled)
- For better optimization, use `./make-windows.sh`

Usage:
Expand Down
2 changes: 1 addition & 1 deletion flatpak/com.github.Alcaro.Flips.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"name" : "flips",
"buildsystem" : "simple",
"build-commands": [
"sh make-linux.sh --cflags=-DFLATPAK",
"sh make-linux.sh",
"make install PREFIX=/app"
],
"sources" : [
Expand Down
10 changes: 4 additions & 6 deletions make-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
FLAGS='-Wall -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden'
FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables'
FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/'
#Linux flags, they don't make sense on Windows
#make-maintainer.sh uses this
LINFLAGS=' -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax'
FLAGS=$FLAGS' -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax'

# not a good solution, but imposing Werror on others is rude, and I'm not aware of a better way to detect if it's me
if [ "$HOME" = "/home/walrus" ]; then
Expand Down Expand Up @@ -44,7 +42,7 @@ done
if [ $PROFILE = yes ]; then

echo 'GTK+ (1/3)'
rm obj/* flips; make CFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $?
rm obj/* flips; make CFLAGS="$FLAGS -fprofile-generate -lgcov" || exit $?
[ -e flips ] || exit 1

echo 'GTK+ (2/3)'
Expand All @@ -61,7 +59,7 @@ $TIME ./flips --create --bps-delta profile/firefox-10.0esr.tar profile/f
$TIME ./flips --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null

echo 'GTK+ (3/3)'
rm flips; make CFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $?
rm flips; make CFLAGS="$FLAGS -fprofile-use" || exit $?
else
rm flips; make CFLAGS="$FLAGS$LINFLAGS" || exit $?
rm flips; make CFLAGS="$FLAGS" || exit $?
fi
56 changes: 0 additions & 56 deletions make-maintainer.sh

This file was deleted.

18 changes: 11 additions & 7 deletions make-windows.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@ FLAGS='-Wall -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-cons
FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables'
FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/'

# Can be overridden to build Windows binaries from a Linux host
# for example WINE=wine MAKE=mingw32-make ./make-windows.sh
MAKE="${MAKE:-make}"
WINE="${WINE:-}"


rm floating.zip
rm -r obj/* || true

#if trying to make a 32bit Flips, add -Wl,--large-address-aware

echo 'Windows (1/3)'
rm -r obj/* flips.exe; make CFLAGS="$FLAGS -fprofile-generate -lgcov"
rm -r obj/* flips.exe; $MAKE CFLAGS="$FLAGS -fprofile-generate -lgcov"
[ -e flips.exe ] || exit
echo 'Windows (2/3)'
./flips.exe --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
./flips.exe --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
$WINE ./flips.exe --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
$WINE ./flips.exe --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
echo 'Windows (3/3)'
rm flips.exe; make CFLAGS="$FLAGS -fprofile-use -s"

rm flips.exe; $MAKE CFLAGS="$FLAGS -fprofile-use -s"

#verify that there are no unexpected dependencies
objdump -p flips.exe | grep 'DLL Name' | \
grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32|api-ms-win-crt)' && \
echo "Invalid dependency" && exit 1

exit 0

# a script's exit status is the same as the last command or pipeline run; if that's the above grep, things break
true

0 comments on commit 6267f57

Please sign in to comment.