Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional build improvements for december 2024 #507

Merged
merged 24 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
daf3d09
git subrepo clone --branch=d1ff06cc503a74dca0150d5e988f2c93158b0cdf h…
jamievlin Dec 22, 2024
e9e4d33
REPO: Rename bdwgc to gc.
jamievlin Dec 23, 2024
535935c
REPO: Unignore gc files.
jamievlin Dec 23, 2024
15cc98d
git subrepo clone --branch=v7.8.2 https://github.com/ivmai/libatomic_ops
jamievlin Dec 22, 2024
b5a6fd0
REPO: Remove libatomic_ops from ignore list.
jamievlin Dec 22, 2024
92a60fb
VCPKG: Remove gc from vcpkg install list.
jamievlin Dec 22, 2024
a02ebe8
CMAKE: Use subrepo-cloned libatomic_ops and bdwgc for asymptote.
jamievlin Dec 22, 2024
203ea75
git subrepo pull LspCpp
jamievlin Dec 22, 2024
2b0f0c3
GUI: Remove click from buildtool.
jamievlin Dec 22, 2024
889ba00
GUI: Remove click from dev dependency list.
jamievlin Dec 22, 2024
54253b0
MAKE: Support local gc in build process.
jamievlin Dec 24, 2024
3c5828d
GC: Set +x on autogen.sh.
jamievlin Dec 24, 2024
e2af319
CMAKE: Change HAVE_GL to HAVE_LIBGL during configuration.
jamievlin Dec 24, 2024
8147396
git subrepo clone --force --branch=v8.2.8 https://github.com/ivmai/bd…
johncbowman Dec 24, 2024
8405b66
GC: Update GC to latest stable release.
johncbowman Dec 24, 2024
0916cfc
Remove obsolete configuration code.
johncbowman Dec 25, 2024
91d4d8d
Update autoconf version.
johncbowman Dec 26, 2024
468f63a
Remove obsolete code.
johncbowman Dec 26, 2024
3bcf5fd
GC: Update configure.ac.
johncbowman Dec 26, 2024
637ba8f
Quote ENABLE_LSP_MACRO.
johncbowman Dec 26, 2024
7fbc53c
Check for libtoolize.
johncbowman Dec 27, 2024
9a22de4
Remove extra spaces; fix gc compilation; require libtool instead of l…
johncbowman Dec 28, 2024
492d883
Update build-asymptote.
johncbowman Dec 28, 2024
94ccb43
Run gc/autogen.sh.
johncbowman Dec 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
__pycache__

### Compressed packages and Garbage Collector
gc-*
*.tar.gz
*.tgz
libatomic*

### Binaries
asy
xasy

### Version info
*version.*
!gc/include/gc_version.h
!gc/m4/gc_set_version.m4
!version.texi.in
revision.*

Expand Down
93 changes: 45 additions & 48 deletions GUI/buildtool.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
import argparse
import pathlib
import sys
import subprocess
import shutil
from typing import Optional

import click
from PyQt5.uic import compileUiDir
import os

Expand All @@ -21,33 +21,25 @@
PY_VERSION_MODULE_DIR = BUILD_ROOT_DIRECTORY / "xasyversion"


def add_version_override_arg(cmd_fn):
return click.option(
"--version-override",
default=None,
type=str,
help="Version to use. If not given, uses information from configure.ac.",
)(cmd_fn)


def _mapUiFile(_: str, fileName: str):
def _map_ui_file(_: str, fileName: str):
return str(PY_UI_FILE_DIR), fileName


def make_init_py_at_dir(dir_name: pathlib.Path):
(dir_name / "__init__.py").touch(exist_ok=True)


@click.command()
def buildUi():
def build_ui():
compileUiDir(
"windows", map=_mapUiFile, from_imports=True, import_from=XASY_ICONS_MODULE_NAME
"windows",
map=_map_ui_file,
from_imports=True,
import_from=XASY_ICONS_MODULE_NAME,
)
make_init_py_at_dir(PY_UI_FILE_DIR)


@click.command()
def buildIcons():
def build_icons():
PY_ICONS_FILE_DIR.mkdir(exist_ok=True)
make_init_py_at_dir(PY_ICONS_FILE_DIR)
subprocess.run(
Expand All @@ -60,7 +52,7 @@ def buildIcons():
)


def determineAsyVersion() -> str:
def determine_asy_version() -> str:
version_base = determine_pkg_info.determine_asy_pkg_info(
BUILD_ROOT_DIRECTORY.parent / "configure.ac"
).get("version-base")
Expand All @@ -69,24 +61,17 @@ def determineAsyVersion() -> str:
return version_base


def buildVersionModuleInternal(version_override: Optional[str] = None):
def build_verison_module(version_override: Optional[str] = None):
PY_VERSION_MODULE_DIR.mkdir(exist_ok=True)
make_init_py_at_dir(PY_VERSION_MODULE_DIR)
if version_override is not None:
version = version_override
else:
version = determineAsyVersion()
version = determine_asy_version()
with open(PY_VERSION_MODULE_DIR / "version.py", "w", encoding="utf-8") as f:
f.write(f'VERSION="{version}"\n')


@click.command()
@add_version_override_arg
def buildVersionModule(version_override: Optional[str]):
buildVersionModuleInternal(version_override)


@click.command()
def clean():
if PY_UI_FILE_DIR.exists():
shutil.rmtree(PY_UI_FILE_DIR)
Expand All @@ -98,28 +83,40 @@ def clean():
shutil.rmtree(PY_VERSION_MODULE_DIR)


@click.command()
@click.pass_context
@add_version_override_arg
def build(ctx: click.Context, version_override: Optional[str] = None):
ctx.invoke(buildUi)
ctx.invoke(buildIcons)
buildVersionModuleInternal(version_override)


@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx: click.Context):
if ctx.invoked_subcommand is None:
ctx.invoke(build)


cli.add_command(buildUi)
cli.add_command(buildIcons)
cli.add_command(buildVersionModule)
cli.add_command(build)
cli.add_command(clean)
def parse_args():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help="subcommands", dest="subcommand")
version_parser = subparsers.add_parser(
"buildversionmodule", help="build version module"
)
build_parser = subparsers.add_parser("build", help="build command")
for subparser in [build_parser, version_parser]:
subparser.add_argument("--version-override", required=False, type=str)

subparsers.add_parser("clean", help="clean command")
subparsers.add_parser("buildicons", help="build icons")
subparsers.add_parser("buildui", help="build ui files")

return parser.parse_args()


def main():
args = parse_args()
if args.subcommand == "buildui":
build_ui()
elif args.subcommand == "buildicons":
build_icons()
elif args.subcommand == "buildversionmodule":
build_verison_module(args.version_override)
elif args.subcommand == "build":
build_ui()
build_icons()
build_verison_module(args.version_override)
elif args.subcommand == "clean":
clean()
else:
raise RuntimeError("Unknown subcommand")


if __name__ == "__main__":
cli()
main()
1 change: 0 additions & 1 deletion GUI/requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
click~=8.1.7
setuptools~=70.0.0
4 changes: 2 additions & 2 deletions LspCpp/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:vectorgraphics/LspCpp
branch = master
commit = d12eab466ee2c9eb8bb8925ec8482e374a880fcc
parent = 2c34fbcaf9d487f6fd7a9299649dbc9f76860e83
commit = 80e204a4fc9f088b9732e66affa114ca459d3151
parent = 91cae6a300d7bf25381f9630f190a0531e6f107d
method = merge
cmdver = 0.4.9
5 changes: 5 additions & 0 deletions LspCpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ where the tar.gz file is extracted to. This directory must be an absolute path.
If this setting is set, LspCpp will use downloaded GC regardless of whether GC from find_package or
pkg_config is available or not.
")
option_if_not_defined(LSPCPP_GC_STATIC "Compiling with static gc library. Only used if a custom GC root is given" OFF)

###########################################################
# Boehm GC
Expand Down Expand Up @@ -187,6 +188,10 @@ function(lspcpp_set_target_options target)
if (LSPCPP_GC_DOWNLOADED_ROOT)
message(STATUS "Using manually downloaded GC")
target_include_directories(${target} PUBLIC ${LSPCPP_GC_DOWNLOADED_ROOT}/include)

if (LSPCPP_GC_STATIC)
target_compile_definitions(${target} PUBLIC GC_NOT_DLL)
endif()
else()
if (NOT GC_USE_PKGCONFIG)
message(STATUS "Using cmake config for locating gc")
Expand Down
47 changes: 8 additions & 39 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ ARCH = unix
POLL = poll

ASYGLVERSION = @ASYGLVERSION@
GCVERSION = @GCVERSION@
GC = gc-$(GCVERSION)
LIBATOMIC = libatomic_ops-@ATOMICVERSION@
GC = gc
GCOPTIONS = @GCOPTIONS@
GCLIB = @GCLIB@
GCPPLIB = @GCPPLIB@
Expand Down Expand Up @@ -92,7 +90,7 @@ DEFS = @DEFS@ @OPTIONS@ @PTHREAD_CFLAGS@ -DFFTWPP_SINGLE_THREAD -Wall
CFLAGS = @CFLAGS@
OPTS = $(DEFS) @CPPFLAGS@ @CXXFLAGS@ $(CFLAGS) \
-Ibackports/optional/include \
-Iprc/include -I$(LSP_ROOT)/include -I.
-Iprc/include -I$(LSP_ROOT)/include
GLEWOPTS = $(DEFS) @CPPFLAGS@ $(CFLAGS) -DGLEW_NO_GLU -DGLEW_BUILD -O1 -fPIC

# Options for compiling the object files for the shared library.
Expand Down Expand Up @@ -176,34 +174,10 @@ $(LSP_BUILD_ROOT)/liblspcpp.a:

all: asy sty man faq asy-keywords.el

$(GCLIB): $(GC).tar.gz
gunzip -c $(GC).tar.gz > $(GC).tar
tar -xf $(GC).tar
rm -f $(GC).tar
if test -r $(LIBATOMIC).tar.gz; then \
gunzip -c $(LIBATOMIC).tar.gz > $(LIBATOMIC).tar; \
tar -xf $(LIBATOMIC).tar; \
rm -f $(LIBATOMIC).tar; \
mv $(LIBATOMIC) $(GC)/libatomic_ops; \
fi
if test "$(GC)" = "gc-7.0"; then \
cd $(GC)/include/private && \
patch < ../../../patches/gc-7.0nomem.patch; \
fi
if test "$(GC)" = "gc-7.2b"; then \
mv gc-7.2 gc-7.2b; \
fi
if test "$(GC)" = "gc-7.2c"; then \
mv gc-7.2 gc-7.2c; \
fi
if test "$(GC)" = "gc-7.2d"; then \
mv gc-7.2 gc-7.2d; \
fi
cd $(GC) && \
./configure CC="$(CC)" CXX="$(CXX)" $(GCOPTIONS); \
$(MAKE) check

$(GCPPLIB): $(GCLIB)
$(GCLIB):
ln -sf ../libatomic_ops libatomic_ops
cd $(GC) && ./configure CC="$(CC)" CXX="$(CXX)" $(GCOPTIONS)
$(MAKE) -C $(GC) check

sty: doc/version.texi
cd doc && $(MAKE) asy-latex.pdf
Expand Down Expand Up @@ -395,16 +369,11 @@ clean: FORCE
-cd GUI && $(PYTHON) buildtool.py clean

gc-clean: FORCE clean
-if test -d $(GC); then \
$(MAKE) -C $(GC) clean; \
fi
-$(MAKE) -C $(GC) clean

cleaner: FORCE clean
-if test -d $(GC); then \
rm -rf $(GC); \
fi
-$(MAKE) -C $(GC) distclean
-rm -f Makefile config.h config.log config.status errors.temp
-rm -rf acextlibs
cd doc && $(MAKE) clean
cd tests && $(MAKE) distclean

Expand Down
2 changes: 2 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

autoheader && autoconf

cd gc && ./autogen.sh
11 changes: 0 additions & 11 deletions build-scripts/build-asymptote
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ SHARED=$HOME/shared/asy
ASYMPTOTE=$HOME/asymptote
BUILD=/usr/local/src

GCVERSION=8.2.4
ATOMICVERSION=7.6.12
GC=gc-$GCVERSION

MAKEFLAGS=-j8
export MAKEFLAGS

Expand All @@ -31,10 +27,6 @@ cd $BUILD
rm -rf asymptote-$VERSION
rm -rf $BUILD/$BINDIR
mv asymptote asymptote-$VERSION
wget https://github.com/ivmai/bdwgc/releases/download/v$GCVERSION/gc-$GCVERSION.tar.gz
wget https://github.com/ivmai/libatomic_ops/releases/download/v$ATOMICVERSION/libatomic_ops-$ATOMICVERSION.tar.gz
cp /usr/local/src/$GC.tar.gz asymptote-$VERSION
cp /usr/local/src/libatomic_ops-$ATOMICVERSION.tar.gz asymptote-$VERSION
chown -R root:root asymptote-$VERSION
cd asymptote-$VERSION
find . -name ".[^.]*" -exec rm -rf {} \;
Expand All @@ -54,11 +46,8 @@ make $MAKEFLAGS asy
rm base/webgl/asygl-*.js
make -j1 all
make -j1 install
#rm asy
#make LFLAGS=-static
strip asy
make DESTDIR="$BUILD/" latexdir=$LATEXDIR install
#rm $GC.tar.gz
rm $BUILD/$BINDIR/local/info/dir
cp -a $BUILD/asymptote-$VERSION/ChangeLog .
cp -a $ASYMPTOTE/ReleaseNotes .
Expand Down
36 changes: 1 addition & 35 deletions cmake-scripts/external-libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,6 @@ else()
message(FATAL_ERROR "glm not found; will not use glm")
endif()

# -------- not required, but highly recommend if your system can build it ---------
# these options are (mostly) on by default

# boehm gc

if (ENABLE_GC)
find_package(BDWgc CONFIG)
if (BDWgc_FOUND)
list(APPEND ASY_STATIC_LIBARIES BDWgc::gc BDWgc::gccpp)

# We use #include <gc.h> as opposed to <gc/gc.h> (and also for other gc include files) to allow
# linking directly to the compiled source for testing different GC versions.

# In GC tarballs downloaded from https://www.hboehm.info/gc/, the header files are in include/gc.h, and not
# include/gc/gc.h, hence we need a way to allow inclusion of "gc.h". In vcpkg gc distributions, the include
# files are provided in include/gc/gc.h (and other files). Hence we append "/gc" to the include directories.
list(APPEND
ASYMPTOTE_INCLUDES
$<LIST:TRANSFORM,$<TARGET_PROPERTY:BDWgc::gc,INTERFACE_INCLUDE_DIRECTORIES>,APPEND,/gc>
$<LIST:TRANSFORM,$<TARGET_PROPERTY:BDWgc::gccpp,INTERFACE_INCLUDE_DIRECTORIES>,APPEND,/gc>
)

if (WIN32)
list(APPEND ASY_STATIC_LIBARIES BDWgc::gctba)
endif()
list(APPEND ASY_MACROS USEGC)
else()
message(FATAL_ERROR "BDWgc not found")
endif()
else()
message(STATUS "Disabling gc support")
endif()


if (ENABLE_READLINE)
# curses
if (UNIX)
Expand Down Expand Up @@ -223,7 +189,7 @@ if (ENABLE_OPENGL)
endif()

if (OPENGL_GLU_FOUND)
list(APPEND ASY_MACROS HAVE_GL)
list(APPEND ASY_MACROS HAVE_LIBGL)
else()
message(FATAL_ERROR "GL components incomplete; will not use OpenGL")
endif()
Expand Down
Loading